Package jason.stdlib
Class list_files
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.list_files
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".list_files(path,pattern)",
hint="lists files of a folder",
argsHint={"path to be listed","a regular expression file names should match [optional]"},
argsType={"string","string"},
examples={".list_files(\"./\",R): unifies R with the list of all files in the working directory and subdirectories",".list_files(\"./src/agt\",\".*.asl\",L): unifies L with the list of all \'.asl\' files in the directory and subdirectories",".list_files(\"/media/movies\",\".*[(][0-9]{4}[)].*\",L): unifies L with the list of all files in \'/media/movies\' in which the name contains 4 numbers between parenthesis."},
seeAlso={"jason.stdlib.create_agent","jason.stdlib.save_agent"})
public class list_files
extends DefaultInternalAction
Internal action: .list_files
.
Description: lists files of a folder
Parameters:
- + path (string): path to be listed.
- + pattern (string -- optional): a regular expression file names should match.
Examples:
-
.list_files("./",R)
: unify in R the list of all files in the working directory and its subdirectories. -
.list_files("./src/agt",".*.asl",L)
: unify in L the list of all '.asl' files in the directory '.src/agt/' and its subdirectories (e.g. [./src/agt/bob.asl, .src/agt/alice.asl]) -
.list_files("/media/movies",".*[(][0-9]{4}[)].*",L)
: unify in L the list of all files in '/media/movies' in which the name contains 4 numbers between parenthesis.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkArguments
(Term[] args) execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.protected String
int
int
protected String
getPattern
(Term[] args) Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
list_files
public list_files()
-
-
Method Details
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
in classDefaultInternalAction
-
checkArguments
- Overrides:
checkArguments
in classDefaultInternalAction
- Throws:
JasonException
-
execute
Description copied from interface:InternalAction
Executes the internal action. It should return a Boolean or an Iterator. A true boolean return means that the IA was successfully executed. An Iterator result means that there is more than one answer for this IA (e.g. see member internal action). - Specified by:
execute
in interfaceInternalAction
- Overrides:
execute
in classDefaultInternalAction
- Throws:
Exception
-
getFolder
- Throws:
JasonException
-
getPattern
- Throws:
JasonException
-