Package jason.stdlib
Class create_agent
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.create_agent
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".create_agent(name[,source,customisations])",
hint="creates agent using the referred AgentSpeak source code",
argsHint={"the name for the new agent","path to the AgentSpeak code file [optional]","list of optional parameters [optional]"},
argsType={"atom, string, or variable","string","list"},
examples={".create_agent(bob,\"/tmp/x.asl\"): creates an agent named \"bob\" from the source file in \"/tmp/x.asl\"",".create_agent(Bob,\"/tmp/x.asl\"): creates an agent named \"bob\" (or \"bob_1\", \"bob_2\", ...) and unifies variable Bob with the given name",".create_agent(bob,\"x.asl\", [agentClass(\"myp.MyAgent\")]): creates the agent \"bob\" with customised agent class myp.MyAgent",".create_agent(bob,\"x.asl\", [agentArchClass(\"myp.MyArch\")]): creates the agent with customised architecture class myp.MyArch",".create_agent(bob,\"x.asl\", [beliefBaseClass(\"jason.bb.TextPersistentBB\")]): creates the agent with customised belief base jason.bb.TextPersistentBB",".create_agent(bob,\"x.asl\", [agentClass(\"myp.MyAgent\"),\tagentArchClass(\"myp.MyArch\"), beliefBaseClass(\"jason.bb.TextPersistentBB\")]): creates the customized agent"},
seeAlso={"jason.stdlib.save_agent","jason.stdlib.kill_agent","jason.stdlib.stopMAS","jason.runtime.RuntimeServices"})
public class create_agent
extends DefaultInternalAction
Internal action: .create_agent
.
Description: creates another agent using the referred AgentSpeak source code.
Parameters:
- + name (atom, string, or variable): the name for the new agent.
If this parameter is a variable, it will be unified with the name given to the agent.
The agent's name will be the name of the variable and some number that makes it unique.
- + source (string -- optional): path to the file where the AgentSpeak code
for the new agent can be found.
- + customisations (list -- optional): list of optional parameters
as agent class, architecture and belief base.
Examples:
-
.create_agent(bob,"/tmp/x.asl")
: creates an agent named "bob" from the source file in "/tmp/x.asl". -
.create_agent(Bob,"/tmp/x.asl")
: creates an agent named "bob" (or "bob_1", "bob_2", ...) and unifies variable Bob with the given name. -
.create_agent(bob,"x.asl", [agentClass("myp.MyAgent")])
: creates the agent with customised agent classmyp.MyAgent
. -
.create_agent(bob,"x.asl", [agentArchClass("myp.MyArch")])
: creates the agent with customised architecture classmyp.MyArch
. -
.create_agent(bob,"x.asl", [beliefBaseClass("jason.bb.TextPersistentBB")])
: creates the agent with customised belief basejason.bb.TextPersistentBB
. -
.create_agent(bob,"x.asl", [agentClass("myp.MyAgent"), agentArchClass("myp.MyArch"), beliefBaseClass("jason.bb.TextPersistentBB")])
: creates the agent with agent, architecture and belief base customised.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkArguments
(Term[] args) execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.getAgArchClasses
(Term[] args) int
int
protected String
protected Settings
protected String
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
create_agent
public create_agent()
-
-
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
-
getSettings
-
getName
-
getSource
- Throws:
JasonException
-
getAgArchClasses
-