|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.util.TransactionalList
The TransactionalList
class implements a list of objects that has the special property that it
can be frozen temporarily and unfrozen. During the time that the list is "frozen", requests to add or remove
objects from the list are queued. Upon unfreezing, the queue of requests is processed in order, and then
the list is free to have objects added and removed again.
Nested Class Summary | |
protected static class |
TransactionalList.Link
The Link class is used internally to represent links for the list of objects and
updates. |
Field Summary | |
protected TransactionalList.Link |
head
|
protected int |
nesting
|
protected TransactionalList.Link |
tail
|
protected TransactionalList.Link |
transHead
|
protected TransactionalList.Link |
transTail
|
Constructor Summary | |
TransactionalList()
|
Method Summary | |
void |
add(java.lang.Object b)
The add() method allows another probe to be inserted into the multicast set. |
void |
beginTransaction()
The beginTransaction() method freezes this list so that further requests for updates
(such as to add or remove objects) are queued until the transaction is completed, which is triggered
by a called to endTransaction() . |
void |
endTransaction()
The endTransaction() method unlocks this list from the transaction and will process
any queued adds or removes in order from the time the beginTransaction() method was called. |
boolean |
isEmpty()
The isEmpty() method tests whether this list is empty. |
void |
remove(java.lang.Object o)
The remove method removes a probe from the multicast set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected TransactionalList.Link head
protected TransactionalList.Link tail
protected TransactionalList.Link transHead
protected TransactionalList.Link transTail
protected int nesting
Constructor Detail |
public TransactionalList()
Method Detail |
public void add(java.lang.Object b)
add()
method allows another probe to be inserted into the multicast set. It will be
inserted at the end of the list of current probes and will therefore fire after any probes already in
the multicast set.
b
- the probe to insertpublic void remove(java.lang.Object o)
remove
method removes a probe from the multicast set. The order of the remaining
probes is not changed. The comparison used is reference equality, not the .equals()
method.
o
- the probe to removepublic boolean isEmpty()
isEmpty()
method tests whether this list is empty. If this list is currently in
a transaction (frozen), this method does not consider pending updates to the list.
public void beginTransaction()
beginTransaction()
method freezes this list so that further requests for updates
(such as to add or remove objects) are queued until the transaction is completed, which is triggered
by a called to endTransaction()
. When this method is called, all pending requests to
add or remove objects are processed in order.
public void endTransaction()
endTransaction()
method unlocks this list from the transaction and will process
any queued adds or removes in order from the time the beginTransaction()
method was called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |