|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EventList
An interface for implementations of event lists.
Different implementations are provided in SSJ:
doubly-linked list, splay tree, Henricksen's method, etc.
The events in the event list are objects of the class
Event
.
The method Sim.init
permits one to select
the actual implementation used in a simulation.
To allow the user to print the event list, the
toString
method
from the Object
class should be reimplemented in all EventList
implementations. It will return a string in the following format:
``Contents of the event list event list class:'' for the first line and
each subsequent line has format
``scheduled event time, event priority : event string''.
The event string is obtained by calling the
toString method of the event objects.
The string should not end with the end-of-line character.
The following example is the event list of the bank example, printed at 10h30. See examples.pdf for more information.
Contents of the event list SplayTree: 10.51, 1 : BankEv$Arrival@cfb549 10.54, 1 : BankEv$Departure@8a7efd 11, 1 : BankEv$3@86d4c1 14, 1 : BankEv$4@f9f9d8 15, 1 : BankEv$5@820dda
Method Summary | ||
---|---|---|
void |
add(Event ev)
Adds a new event in the event list, according to the time of ev. |
|
void |
addAfter(Event ev,
Event other)
Same as add , but adds the new event ev
immediately after the event other in the list. |
|
void |
addBefore(Event ev,
Event other)
Same as add , but adds the new event ev
immediately before the event other in the list. |
|
void |
addFirst(Event ev)
Adds a new event at the beginning of the event list. |
|
void |
clear()
Empties the event list, i.e., cancels all events. |
|
Event |
getFirst()
Returns the first event in the event list. |
|
|
getFirstOfClass(Class<E> cl)
Returns the first event of the class E (a subclass of Event) in the event list. |
|
Event |
getFirstOfClass(String cl)
Returns the first event of the class cl (a subclass of Event) in the event list. |
|
boolean |
isEmpty()
Returns true if and only if the event list is empty (no event is scheduled). |
|
ListIterator<Event> |
listIterator()
Returns a list iterator over the elements of the class Event in this list. |
|
boolean |
remove(Event ev)
Removes the event ev from the event list (cancels this event). |
|
Event |
removeFirst()
Removes the first event from the event list (to cancel or execute this event). |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
boolean isEmpty()
void clear()
void add(Event ev)
ev
- event to be addedvoid addFirst(Event ev)
ev
- event to be addedvoid addBefore(Event ev, Event other)
add
, but adds the new event ev
immediately before the event other in the list.
ev
- event to be addedother
- reference event before which ev will be addedvoid addAfter(Event ev, Event other)
add
, but adds the new event ev
immediately after the event other in the list.
ev
- event to be addedother
- reference event after which ev will be addedEvent getFirst()
Event getFirstOfClass(String cl)
<E extends Event> E getFirstOfClass(Class<E> cl)
ListIterator<Event> listIterator()
boolean remove(Event ev)
ev
- event to be removed
Event removeFirst()
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |