|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
E - element typepublic interface Chain<E>
Augmented data type guaranteeing O(1) insertion and removal from a set of ordered, unique elements.
| Method Summary | |
|---|---|
void |
addFirst(E u)
Adds the given object at the beginning of the Chain. |
void |
addLast(E u)
Adds the given object at the end of the Chain. |
boolean |
follows(E someObject,
E someReferenceObject)
Returns true if object someObject follows object someReferenceObject in the Chain. |
E |
getFirst()
Returns the first object in this Chain. |
E |
getLast()
Returns the last object in this Chain. |
E |
getPredOf(E point)
Returns the object immediately preceding point. |
E |
getSuccOf(E point)
Returns the object immediately following point. |
void |
insertAfter(Chain<E> toInsert,
E point)
Inserts toInsert in the Chain after point. |
void |
insertAfter(E toInsert,
E point)
Inserts toInsert in the Chain after point. |
void |
insertAfter(List<E> toInsert,
E point)
Inserts toInsert in the Chain after point. |
void |
insertBefore(Chain<E> toInsert,
E point)
Inserts toInsert in the Chain before point. |
void |
insertBefore(E toInsert,
E point)
Inserts toInsert in the Chain before point. |
void |
insertBefore(List<E> toInsert,
E point)
Inserts toInsert in the Chain before point. |
Iterator<E> |
iterator()
Returns an iterator over this Chain. |
Iterator<E> |
iterator(E u)
Returns an iterator over this Chain, starting at the given object. |
Iterator<E> |
iterator(E head,
E tail)
Returns an iterator over this Chain, starting at head and reaching tail (inclusive). |
boolean |
remove(Object u)
Removes the given object from this Chain. |
void |
removeFirst()
Removes the first object contained in this Chain. |
void |
removeLast()
Removes the last object contained in this Chain. |
int |
size()
Returns the size of this Chain. |
Iterator<E> |
snapshotIterator()
Returns an iterator over a copy of this chain. |
void |
swapWith(E out,
E in)
Replaces out in the Chain by in. |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
| Method Detail |
|---|
void insertBefore(List<E> toInsert,
E point)
toInsert in the Chain before point.
void insertAfter(List<E> toInsert,
E point)
toInsert in the Chain after point.
void insertAfter(E toInsert,
E point)
toInsert in the Chain after point.
void insertBefore(E toInsert,
E point)
toInsert in the Chain before point.
void insertBefore(Chain<E> toInsert,
E point)
toInsert in the Chain before point.
(It would probably be better to make Chain implement List)
void insertAfter(Chain<E> toInsert,
E point)
toInsert in the Chain after point.
(It would probably be better to make Chain implement List)
void swapWith(E out,
E in)
out in the Chain by in.
boolean remove(Object u)
Object to be compatible
with the Collection interface.
remove in interface Collection<E>void addFirst(E u)
void addLast(E u)
void removeFirst()
void removeLast()
boolean follows(E someObject,
E someReferenceObject)
someObject follows object someReferenceObject in the Chain.
E getFirst()
E getLast()
E getSuccOf(E point)
point.
E getPredOf(E point)
point.
Iterator<E> snapshotIterator()
Iterator<E> iterator()
iterator in interface Collection<E>iterator in interface Iterable<E>Iterator<E> iterator(E u)
Iterator<E> iterator(E head,
E tail)
int size()
size in interface Collection<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||