support.graph
Class NodeSequence<E>
java.lang.Object
support.graph.NodeSequence<E>
- All Implemented Interfaces:
- Iterable<E>, Deque<E>, IndexList<E>, PositionList<E>, Sequence<E>
public class NodeSequence<E>
- extends Object
- implements Sequence<E>
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NodeSequence
public NodeSequence()
atIndex
public Position<E> atIndex(int index)
throws BoundaryViolationException
- Specified by:
atIndex in interface Sequence<E>
- Throws:
BoundaryViolationException
indexOf
public int indexOf(Position<E> pos)
throws InvalidPositionException
- Specified by:
indexOf in interface Sequence<E>
- Throws:
InvalidPositionException
size
public int size()
- Specified by:
size in interface Deque<E>- Specified by:
size in interface IndexList<E>- Specified by:
size in interface PositionList<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Deque<E>- Specified by:
isEmpty in interface IndexList<E>- Specified by:
isEmpty in interface PositionList<E>
getFirst
public E getFirst()
throws EmptyDequeException
- Specified by:
getFirst in interface Deque<E>
- Throws:
EmptyDequeException
getLast
public E getLast()
throws EmptyDequeException
- Specified by:
getLast in interface Deque<E>
- Throws:
EmptyDequeException
addFirst
public void addFirst(E element)
- Specified by:
addFirst in interface Deque<E>- Specified by:
addFirst in interface PositionList<E>
addLast
public void addLast(E element)
- Specified by:
addLast in interface Deque<E>- Specified by:
addLast in interface PositionList<E>
removeFirst
public E removeFirst()
throws EmptyDequeException
- Specified by:
removeFirst in interface Deque<E>
- Throws:
EmptyDequeException
removeLast
public E removeLast()
throws EmptyDequeException
- Specified by:
removeLast in interface Deque<E>
- Throws:
EmptyDequeException
add
public void add(int index,
E element)
throws IndexOutOfBoundsException
- Specified by:
add in interface IndexList<E>
- Throws:
IndexOutOfBoundsException
get
public E get(int index)
throws IndexOutOfBoundsException
- Specified by:
get in interface IndexList<E>
- Throws:
IndexOutOfBoundsException
remove
public E remove(int index)
throws IndexOutOfBoundsException
- Specified by:
remove in interface IndexList<E>
- Throws:
IndexOutOfBoundsException
set
public E set(int index,
E element)
throws IndexOutOfBoundsException
- Specified by:
set in interface IndexList<E>
- Throws:
IndexOutOfBoundsException
first
public Position<E> first()
- Specified by:
first in interface PositionList<E>
last
public Position<E> last()
- Specified by:
last in interface PositionList<E>
next
public Position<E> next(Position<E> pos)
throws InvalidPositionException,
BoundaryViolationException
- Specified by:
next in interface PositionList<E>
- Throws:
InvalidPositionException
BoundaryViolationException
prev
public Position<E> prev(Position<E> pos)
throws InvalidPositionException,
BoundaryViolationException
- Specified by:
prev in interface PositionList<E>
- Throws:
InvalidPositionException
BoundaryViolationException
addAfter
public void addAfter(Position<E> pos,
E element)
throws InvalidPositionException
- Specified by:
addAfter in interface PositionList<E>
- Throws:
InvalidPositionException
addBefore
public void addBefore(Position<E> pos,
E element)
throws InvalidPositionException
- Specified by:
addBefore in interface PositionList<E>
- Throws:
InvalidPositionException
remove
public E remove(Position<E> pos)
throws InvalidPositionException
- Specified by:
remove in interface PositionList<E>
- Throws:
InvalidPositionException
set
public E set(Position<E> pos,
E element)
throws InvalidPositionException
- Specified by:
set in interface PositionList<E>
- Throws:
InvalidPositionException
positions
public Iterable<Position<E>> positions()
- Specified by:
positions in interface PositionList<E>
iterator
public Iterator<E> iterator()
- Specified by:
iterator in interface Iterable<E>- Specified by:
iterator in interface PositionList<E>