textbender.g.hold
Class SpoolT
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<Hold>
SpoolT
- All Implemented Interfaces:
- Serializable, Cloneable, Iterable<Hold>, Collection<Hold>, List<Hold>, RandomAccess, Spool
@ThreadSafe
public class SpoolT
- extends Vector<Hold>
- implements Spool
A thread-safe implementation of a spool, based on a Vector.
- See Also:
- Serialized Form
Methods inherited from class java.util.Vector |
addAll, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, toArray, toArray, toString, trimToSize |
Methods inherited from interface java.util.Collection |
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
SpoolT
public SpoolT()
add
public boolean add(Hold hold)
- Adds the hold to the spool, or releases it immediately.
- Specified by:
add
in interface Collection<Hold>
- Specified by:
add
in interface List<Hold>
- Specified by:
add
in interface Spool
- Overrides:
add
in class Vector<Hold>
- Returns:
- true if the hold is added; false if it is released instead
- Throws:
IllegalArgumentException
- if the hold
is not annotated thread-safe
addAll
public boolean addAll(int index,
Collection<? extends Hold> c)
- Specified by:
addAll
in interface List<Hold>
- Overrides:
addAll
in class Vector<Hold>
add
public void add(int index,
Hold hold)
- Specified by:
add
in interface List<Hold>
- Overrides:
add
in class Vector<Hold>
subList
public List<Hold> subList(int fromIndex,
int toIndex)
- Specified by:
subList
in interface List<Hold>
- Overrides:
subList
in class Vector<Hold>
isUnwinding
public boolean isUnwinding()
- Description copied from interface:
Spool
- Returns true if the spool is unwinding (or unwound).
Once true, it never reverts to false.
- Specified by:
isUnwinding
in interface Spool
unwind
public boolean unwind()
- Description copied from interface:
Spool
- Commences to unwind this spool.
Equivalent to unwind(catcher0).
- Specified by:
unwind
in interface Spool
- Returns:
- true if unwinding commences with this call;
false if it had already commenced
unwind
public boolean unwind(Catcher<Hold> catcher)
- Description copied from interface:
Spool
- Commences to unwind this spool, removing and releasing each of its holds.
Works in LIFO order. Once unwinding is commenced,
subsequent calls to this method have no effect.
- Specified by:
unwind
in interface Spool
- Parameters:
catcher
- for any errors or exceptions that occur
during unwinding
- Returns:
- true if unwinding commences with this call;
false if it had already commenced
addElement
public void addElement(Hold hold)
- Overrides:
addElement
in class Vector<Hold>
insertElementAt
public void insertElementAt(Hold hold,
int index)
- Overrides:
insertElementAt
in class Vector<Hold>