stamp.util.os
Class Task
java.lang.Object
|
+--stamp.util.LinkedListItem
|
+--stamp.util.os.Task
- public abstract class Task
- extends LinkedListItem
A task that is run whenever there are free cycles.
To create a new task, you should make a subclass of this class and implement
the execute() and wait() methods.
Constructor Summary |
Task()
|
Method Summary |
void |
enterExecute()
Change the task to the STATE_READY state. |
void |
enterWait()
Change the task to the STATE_WAITING state. |
abstract void |
execute()
Perform a period task. |
void |
stop()
Change the task to the STATE_STOPPED state. |
abstract void |
wait()
If a task is waiting for an event to occur this is a chance for the task
to change its state. |
nextTask
public Task nextTask
state
public int state
- State of the task. Initialized to
STATE_READY
so the task
will execute as soon as possible.
Task
public Task()
execute
public abstract void execute()
- Perform a period task. All subclasses must implement this method.
An idle task is executed whenever the GUI is idle. Implementations of
execute()
should not block to ensure that the
interface remains responsive.
wait
public abstract void wait()
- If a task is waiting for an event to occur this is a chance for the task
to change its state.
enterWait
public void enterWait()
- Change the task to the STATE_WAITING state. Tasks in this state will have
their wait() method called periodically.
enterExecute
public void enterExecute()
- Change the task to the STATE_READY state. Tasks in this state will have
their execute() method called periodically.
stop
public void stop()
- Change the task to the STATE_STOPPED state. Tasks in this state will not
execute at a all.