textbender.g.hold
Class Spool1

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<Hold>
                  extended by Spool1
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Hold>, Collection<Hold>, Deque<Hold>, List<Hold>, Queue<Hold>, Spool
Direct Known Subclasses:
SpoolEDT

public class Spool1
extends LinkedList<Hold>
implements Spool

Basic implementation of a spool.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface Spool
catcher0
 
Constructor Summary
Spool1()
           
 
Method Summary
 boolean add(Hold hold)
          Adds the hold to the spool, or releases it immediately.
 boolean addAll(int index, Collection<? extends Hold> c)
           
 void addFirst(Hold hold)
           
 void addLast(Hold hold)
           
 boolean isUnwinding()
          Returns true if the spool is unwinding (or unwound).
 boolean offer(Hold hold)
           
 boolean unwind()
          Commences to unwind this spool.
 boolean unwind(Catcher<Hold> catcher)
          Commences to unwind this spool, removing and releasing each of its holds.
 
Methods inherited from class java.util.LinkedList
add, addAll, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

Spool1

public Spool1()
Method Detail

add

public boolean add(Hold hold)
Description copied from interface: Spool
Adds the hold to the spool, or releases it immediately. If the spool is unwinding the hold is released immediately; otherwise it is added.

Specified by:
add in interface Collection<Hold>
Specified by:
add in interface Deque<Hold>
Specified by:
add in interface List<Hold>
Specified by:
add in interface Queue<Hold>
Specified by:
add in interface Spool
Overrides:
add in class LinkedList<Hold>
Returns:
true if the hold is added; false if it is released instead

addAll

public boolean addAll(int index,
                      Collection<? extends Hold> c)
Specified by:
addAll in interface List<Hold>
Overrides:
addAll in class LinkedList<Hold>

addFirst

public void addFirst(Hold hold)
Specified by:
addFirst in interface Deque<Hold>
Overrides:
addFirst in class LinkedList<Hold>

addLast

public void addLast(Hold hold)
Specified by:
addLast in interface Deque<Hold>
Overrides:
addLast in class LinkedList<Hold>

offer

public boolean offer(Hold hold)
Specified by:
offer in interface Deque<Hold>
Specified by:
offer in interface Queue<Hold>
Overrides:
offer in class LinkedList<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