io.sarl.api.core
Class AgentTask
class AgentTask
extends SRESpecificDataContainer
Description of a task an agent has schedule to be performed at a later time. This class is not thread-safe.
Maven Group Identifier:
io.sarl.sdk
Maven Artifact Identifier:
api.core
Property Summary
Modifier and type Property and description
org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result> guard
Replies the guard of this task.
java.lang.Object initiator
Replies the object that has initiated the execution of this task.
java.lang.String name
Replies the name of this task.
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Param> procedure
Replies the procedure that is associated to this task.
Field Summary
Modifier and type Field and description
public static val org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result> FALSE_GUARD
A guard that is always false.
public static val org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result> TRUE_GUARD
A guard that is always true.
Constructor Summary
Constructor and description
new(String,[Object])
Construct an AgentTask with the given initiator.
Action Summary
Modifier and type Action and description
org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result> getGuard
Replies the guard of this task.
java.lang.Object getInitiator
Replies the object that has initiated the execution of this task.
java.lang.String getName
Replies the name of this task.
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Param> getProcedure
Replies the procedure that is associated to this task.
AgentTask ifTrue(Function1<Param,Result>)
Change the guard to the given predicate.
void setGuard(Function1<Param,Result>)
Change the guard of this task.
void setProcedure(Procedure1<Param>)
Change the procedure associated to this task.
void setTaskName(String)
Change the name of this task.
java.lang.String toString
AgentTask unless(Function1<Param,Result>)
Change the guard of this that with the negation of the given predicate.
Property Details
guard
var guard : org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result>
Replies the guard of this task.

This property is an alias for the action: getGuard

Returns:
the guard.
initiator
val initiator : java.lang.Object
Replies the object that has initiated the execution of this task. If the value replied by this function is null, the agent is assumed to be the initiator.

This property is an alias for the action: getInitiator

Returns:
the initiator, or null if the initiator is the agent itself.
Since:
0.5
name
val name : java.lang.String
Replies the name of this task.

This property is an alias for the action: getName

Returns:
the name.
procedure
var procedure : org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Param>
Replies the procedure that is associated to this task.

This property is an alias for the action: getProcedure

Returns:
the procedure to run.
Field Details
FALSE_GUARD
public static val FALSE_GUARD : org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result>
A guard that is always false.
TRUE_GUARD
public static val TRUE_GUARD : org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result>
A guard that is always true.
Constructor Details
new(String,[Object])
new(String,[Object])
Construct an AgentTask with the given initiator.
Parameters:
name - the name of the task.
initiator - the object that has initiated the execution of this task. If the value is null (the default value of the argument), the agent is assumed to be the initiator.
Action Details
getGuard
def getGuard : org.eclipse.xtext.xbase.lib.Functions.Function1<Param,Result>
Replies the guard of this task.
Returns:
the guard.
getInitiator
def getInitiator : java.lang.Object
Replies the object that has initiated the execution of this task. If the value replied by this function is null, the agent is assumed to be the initiator.
Returns:
the initiator, or null if the initiator is the agent itself.
Since:
0.5
getName
def getName : java.lang.String
Replies the name of this task.
Returns:
the name.
getProcedure
def getProcedure : org.eclipse.xtext.xbase.lib.Procedures.Procedure1<Param>
Replies the procedure that is associated to this task.
Returns:
the procedure to run.
ifTrue(Function1<Param,Result>)
def ifTrue(Function1<Param,Result>) : AgentTask
Change the guard to the given predicate.
Parameters:
predicate - the code of the function that is the predicate to test.
Returns:
this .
See:
#setGuard
setGuard(Function1<Param,Result>)
def setGuard(Function1<Param,Result>)
Change the guard of this task.
Parameters:
guard - the code of the function that is the predicate associated to the guard.
See:
#unless , #ifTrue
setProcedure(Procedure1<Param>)
def setProcedure(Procedure1<Param>)
Change the procedure associated to this task.
Parameters:
procedure - code of the procedure to associate to the task.
setTaskName(String)
def setTaskName(String)
Change the name of this task.
Parameters:
name - name of the task.
Since:
0.7, it is part of the private API.
Privateapi:
This element is part of the private API of this module.
toString
def toString : java.lang.String
unless(Function1<Param,Result>)
def unless(Function1<Param,Result>) : AgentTask
Change the guard of this that with the negation of the given predicate.
Parameters:
predicate - the code of the function that is the predicate to test.
Returns:
this .
See:
#setGuard