Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim.util
Class TransactionalList

    java.lang.Object
      avrora.sim.util.TransactionalList

Direct Known Subclasses:
  MulticastExceptionWatch, MulticastFSMProbe, MulticastInterruptProbe, MulticastIORWatch, MulticastProbe, MulticastWatch

public class TransactionalList
extends java.lang.Object

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

### head

    protected TransactionalList.Link head

### tail

    protected TransactionalList.Link tail

### transHead

    protected TransactionalList.Link transHead

### transTail

    protected TransactionalList.Link transTail

### nesting

    protected int nesting

Constructor Detail

### TransactionalList

    public TransactionalList()

Method Detail

### add

    public void add(java.lang.Object b)

  The `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.

  Parameters:
    `b` - the probe to insert

### remove

    public void remove(java.lang.Object o)

  The `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.

  Parameters:
    `o` - the probe to remove

### isEmpty

    public boolean isEmpty()

  The `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.

  Returns:
    true if there are no objects in this list; false otherwise

### beginTransaction

    public 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()`. When this method is called, all pending requests to add or remove objects are processed in order.

### endTransaction

    public 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD