public class EventTask extends TimerTask implements Comparable<EventTask>
TimerTask
that calls
AbstractEvent.fireEvent()
when the task is run via the run()
method.Modifier and Type | Field and Description |
---|---|
private PolicyAgentInterface |
agent |
private boolean |
conditional |
private AbstractEvent |
event
The event that is related to this task.
|
Constructor and Description |
---|
EventTask(AbstractEvent newEvent,
PolicyAgentInterface agent)
Creates a new EventTask object associated with the specified event.
|
EventTask(AbstractEvent newEvent,
PolicyAgentInterface agent,
boolean conditional)
Creates a new EventTask object associated with the specified event.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(EventTask o) |
void |
run()
This method calls
AbstractEvent.fireEvent() on the associated
event. |
cancel, scheduledExecutionTime
private AbstractEvent event
private PolicyAgentInterface agent
private boolean conditional
public EventTask(AbstractEvent newEvent, PolicyAgentInterface agent)
newEvent
- The AbstractEvent
that this task is associated
with.agent
- The agent to queue this event topublic EventTask(AbstractEvent newEvent, PolicyAgentInterface agent, boolean conditional)
newEvent
- The AbstractEvent
that this task is associated
with.agent
- The agent to queue this event toconditional
- If conditional is true, then don't queue events if the event is already on the queuepublic void run()
AbstractEvent.fireEvent()
on the associated
event.public int compareTo(EventTask o)
compareTo
in interface Comparable<EventTask>