jasi.sim.basic.event
Interface Event

All Superinterfaces:
java.lang.Comparable<Event>, ExtendedComparable<Event>, java.io.Serializable, SimObject
All Known Implementing Classes:
AbstractEventBean, AbstractRepeatingEvent, ActivityEvent, LandEvent, NextLocationEvent, SimpleEvent, SimpleRepeatingEvent, StartEvent, StatusPrintEvent, StopMovementEvent, TimeStepEvent

public interface Event
extends ExtendedComparable<Event>, SimObject

Basic interface of any simulation event. Events are sorted in first order by their time and in second order by their priority.


Field Summary
static java.util.Comparator<Event> COMPARATOR
          Comparison function, which imposes a total ordering of events.
static int DEFAULT_PRIORITY
          The default priority of events.
 
Method Summary
 void addEventListener(EventListener listener)
          Add an model for this event.
 java.util.Collection<EventListener> getEventListeners()
          Get the unmodifiable collection of the event listeners for this event.
 int getPriority()
          Retrieve the event's priority.
 Time getTime()
          Retrieve the event's time.
 void imported(Calendar calendar)
          This event was pushed to a calendar.
 boolean inform()
          Request, if this event is an internal or external event.
 boolean isInitialized()
          Check, if this event has just been created.
 boolean isPopped()
          Check, if this event has already executed.
 boolean isPushed()
          Check, if this event has already been pushed to a calendar.
 Event popped(Calendar calendar)
          This event was popped from a calendar.
 Event pushed(Calendar calendar)
          This event was pushed to a calendar.
 void removeEventListener(EventListener listener)
          Remove an model for this event.
 
Methods inherited from interface jasi.sim.basic.value.ExtendedComparable
isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface jasi.sim.basic.id.SimObject
getId, setId
 

Field Detail

COMPARATOR

static final java.util.Comparator<Event> COMPARATOR
Comparison function, which imposes a total ordering of events.


DEFAULT_PRIORITY

static final int DEFAULT_PRIORITY
The default priority of events.

See Also:
Constant Field Values
Method Detail

isInitialized

boolean isInitialized()
Check, if this event has just been created.

Returns:
True, if event has just been created.

isPushed

boolean isPushed()
Check, if this event has already been pushed to a calendar.

Returns:
True, if event has already been pushed.

isPopped

boolean isPopped()
Check, if this event has already executed.

Returns:
True, if event has already executed.

getEventListeners

java.util.Collection<EventListener> getEventListeners()
Get the unmodifiable collection of the event listeners for this event.

Returns:
The event listener collection.

addEventListener

void addEventListener(EventListener listener)
Add an model for this event. Each model that shall be informed about handling this event, has to be added to the model list of this event.

Parameters:
listener - The model to handle the event.

removeEventListener

void removeEventListener(EventListener listener)
Remove an model for this event.

Parameters:
listener - The model to handle the event.

getTime

Time getTime()
Retrieve the event's time.

Returns:
The time of this event.

getPriority

int getPriority()
Retrieve the event's priority. A higher priority corresponds to a greater integer value.

Returns:
The priority of this event.

inform

boolean inform()
Request, if this event is an internal or external event. An internal event will not inform listeners of the calendars when pushed or popped.

Returns:
True, when event is external, and False, when internal.

imported

void imported(Calendar calendar)
This event was pushed to a calendar. This method should only be called by the calendar, where this event has been added to.

Parameters:
calendar - The calendar, where this event was pushed to.

pushed

Event pushed(Calendar calendar)
This event was pushed to a calendar. This method should only be called by the calendar, where this event has been added to.

Parameters:
calendar - The calendar, where this event was pushed to.
Returns:
This pushed event.

popped

Event popped(Calendar calendar)
This event was popped from a calendar. All its listeners will be informed to handle or execute this event. Then the list of event listeners will be cleared.

Parameters:
calendar - The calendar which popped this event.
Returns:
This popped event.