|
SSJ V. 1.2.5. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectumontreal.iro.lecuyer.simevents.eventlist.DoublyLinked
public class DoublyLinked
An implementation of EventList using a doubly linked linear list.
Each event is stored into a list node that contains a pointer to its following
and preceding events. Adding an event requires a linear search to keep the event list
sorted by event time. Removing the first event is done in constant
time because it simply removes the first list node.
List nodes are recycled for increased memory management efficiency.
| Constructor Summary | |
|---|---|
DoublyLinked()
|
|
| 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. |
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 |
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). |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DoublyLinked()
| Method Detail |
|---|
public boolean isEmpty()
EventList
isEmpty in interface EventListpublic void clear()
EventList
clear in interface EventListpublic void add(Event ev)
EventList
add in interface EventListev - event to be addedpublic void addFirst(Event ev)
EventList
addFirst in interface EventListev - event to be added
public void addBefore(Event ev,
Event other)
EventListadd, but adds the new event ev
immediately before the event other in the list.
addBefore in interface EventListev - event to be addedother - reference event before which ev will be added
public void addAfter(Event ev,
Event other)
EventListadd, but adds the new event ev
immediately after the event other in the list.
addAfter in interface EventListev - event to be addedother - reference event after which ev will be addedpublic Event getFirst()
EventList
getFirst in interface EventListpublic Event getFirstOfClass(String cl)
EventList
getFirstOfClass in interface EventListpublic boolean remove(Event ev)
EventList
remove in interface EventListev - event to be removed
public Event removeFirst()
EventList
removeFirst in interface EventListpublic ListIterator listIterator()
EventList
listIterator in interface EventListpublic String toString()
toString in class Object
|
SSJ V. 1.2.5. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||