public abstract class AbstractTask extends SimplePropertyObject implements IObjectTask
Modifier and Type | Field and Description |
---|---|
protected IBooleanCondition |
condition
The task condition (optional).
|
protected boolean |
finished
The finished flag.
|
static java.lang.String |
PROPERTY_CONDITION
The task condition property.
|
pcs, properties
PROPERTY_ID
Constructor and Description |
---|
AbstractTask() |
Modifier and Type | Method and Description |
---|---|
void |
execute(IEnvironmentSpace space,
ISpaceObject obj,
long progress,
IClockService clock)
Executes the task.
|
boolean |
isFinished(IEnvironmentSpace space,
ISpaceObject obj)
Check if a task is finished and should be removed.
|
void |
setFinished(IEnvironmentSpace space,
ISpaceObject obj,
boolean finished)
Indicate that the task is finished and should be removed.
|
void |
shutdown(ISpaceObject obj)
This method will be executed by the object before the task is removed
from the execution queue.
|
void |
start(ISpaceObject obj)
This method will be executed by the object before the task gets added to
the execution queue.
|
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProperty, getPropertyNames, hasProperty, setProperty
public static final java.lang.String PROPERTY_CONDITION
protected boolean finished
protected IBooleanCondition condition
public void start(ISpaceObject obj)
start
in interface IObjectTask
space
- The environment in which the task is executing.obj
- The object that is executing the task.public void shutdown(ISpaceObject obj)
shutdown
in interface IObjectTask
space
- The environment in which the task is executing.obj
- The object that is executing the task.public void execute(IEnvironmentSpace space, ISpaceObject obj, long progress, IClockService clock)
execute
in interface IObjectTask
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.public boolean isFinished(IEnvironmentSpace space, ISpaceObject obj)
isFinished
in interface IObjectTask
public void setFinished(IEnvironmentSpace space, ISpaceObject obj, boolean finished)
space
- The environment in which the task is executing.obj
- The object that is executing the task.finished
- The finished flag.