Class AbstractTask
- java.lang.Object
-
- jadex.commons.SimplePropertyObject
-
- jadex.extension.envsupport.environment.AbstractTask
-
- All Implemented Interfaces:
IPropertyObject,IObjectTask
public abstract class AbstractTask extends SimplePropertyObject implements IObjectTask
Empty default implementation for object tasks.
-
-
Field Summary
Fields Modifier and Type Field Description protected IBooleanConditionconditionThe task condition (optional).protected booleanfinishedThe finished flag.static java.lang.StringPROPERTY_CONDITIONThe task condition property.-
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
-
Fields inherited from interface jadex.extension.envsupport.environment.IObjectTask
PROPERTY_ID
-
-
Constructor Summary
Constructors Constructor Description AbstractTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(IEnvironmentSpace space, ISpaceObject obj, long progress, IClockService clock)Executes the task.booleanisFinished(IEnvironmentSpace space, ISpaceObject obj)Check if a task is finished and should be removed.voidsetFinished(IEnvironmentSpace space, ISpaceObject obj, boolean finished)Indicate that the task is finished and should be removed.voidshutdown(ISpaceObject obj)This method will be executed by the object before the task is removed from the execution queue.voidstart(ISpaceObject obj)This method will be executed by the object before the task gets added to the execution queue.-
Methods inherited from class jadex.commons.SimplePropertyObject
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jadex.commons.IPropertyObject
getProperty, getPropertyNames, hasProperty, setProperty
-
-
-
-
Field Detail
-
PROPERTY_CONDITION
public static final java.lang.String PROPERTY_CONDITION
The task condition property.- See Also:
- Constant Field Values
-
finished
protected boolean finished
The finished flag.
-
condition
protected IBooleanCondition condition
The task condition (optional). Task is executed as long as the condition is true.
-
-
Method Detail
-
start
public void start(ISpaceObject obj)
This method will be executed by the object before the task gets added to the execution queue. Empty default implementation that can be replaced by subclasses.- Specified by:
startin interfaceIObjectTask- Parameters:
space- The environment in which the task is executing.obj- The object that is executing the task.
-
shutdown
public void shutdown(ISpaceObject obj)
This method will be executed by the object before the task is removed from the execution queue. Notifies the listener and hence should be called when overridden in subclasses.- Specified by:
shutdownin interfaceIObjectTask- Parameters:
space- The environment in which the task is executing.obj- The object that is executing the task.
-
execute
public void execute(IEnvironmentSpace space, ISpaceObject obj, long progress, IClockService clock)
Executes the task.- Specified by:
executein interfaceIObjectTask- Parameters:
space- The environment in which the task is executing.obj- The object that is executing the task.progress- The time that has passed according to the environment executor.clock- The clock service.
-
isFinished
public boolean isFinished(IEnvironmentSpace space, ISpaceObject obj)
Check if a task is finished and should be removed. Finished tasks will no longer be executed.- Specified by:
isFinishedin interfaceIObjectTask- Returns:
- True, if the task is finished.
-
setFinished
public void setFinished(IEnvironmentSpace space, ISpaceObject obj, boolean finished)
Indicate that the task is finished and should be removed.- Parameters:
space- The environment in which the task is executing.obj- The object that is executing the task.finished- The finished flag.
-
-