Class BiList.BiIterator

java.lang.Object
  extended by BiList.BiIterator
All Implemented Interfaces:
BiIteratorI<E>
Enclosing class:
BiList<E>

private class BiList.BiIterator
extends Object
implements BiIteratorI<E>

A true inner class that includes a link (BiList.this) to the enclosing BiList.


Field Summary
(package private)  BiList.Node<E> current
           
 
Constructor Summary
BiList.BiIterator()
           
 
Method Summary
 boolean atEnd()
           
 boolean atStart()
          Returns true if CircList is non-empty and current is the first node in the list.
 E currentItem()
           
 E first()
          Moves cursor to the first element f of the collection.
 void insert(E o)
          Destructively inserts the object o immediately before the current item.
 E last()
          Places the cursor on the last element l of the collection.
 E next()
          Moves cursor to the next element n of the collection.
 E prev()
          Moves cursor to the previous element p of the collection.
 E remove()
          Removes the current item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

BiList.Node<E> current
Constructor Detail

BiList.BiIterator

BiList.BiIterator()
Method Detail

first

public E first()
Description copied from interface: BiIteratorI
Moves cursor to the first element f of the collection. Behavior unspecified on empty collecton.

Specified by:
first in interface BiIteratorI<E>
Returns:
the first element f.

last

public E last()
Description copied from interface: BiIteratorI
Places the cursor on the last element l of the collection. Behavior is unspecified if the collection is empty.

Specified by:
last in interface BiIteratorI<E>
Returns:
the last element l.

next

public E next()
Description copied from interface: BiIteratorI
Moves cursor to the next element n of the collection. Behavior unspecified on empty collecton.

Specified by:
next in interface BiIteratorI<E>
Returns:
the next element n.

prev

public E prev()
Description copied from interface: BiIteratorI
Moves cursor to the previous element p of the collection. Behavior is unspecified if the collection is empty.

Specified by:
prev in interface BiIteratorI<E>
Returns:
the next element p.

currentItem

public E currentItem()
Specified by:
currentItem in interface BiIteratorI<E>
Returns:
the value of the current element (pointed to by the cursor).

atEnd

public boolean atEnd()
Specified by:
atEnd in interface BiIteratorI<E>
Returns:
true if cursor is pointing to the dummy node (the header) beyond the last element of the collection.

atStart

public boolean atStart()
Returns true if CircList is non-empty and current is the first node in the list.

Specified by:
atStart in interface BiIteratorI<E>
Returns:
true if cursor is pointing to the first element of the collection.

insert

public void insert(E o)
Description copied from interface: BiIteratorI
Destructively inserts the object o immediately before the current item. If the list is empty, or the cursor is atEnd(), the node is inserted immediately before the end of the list.

Specified by:
insert in interface BiIteratorI<E>

remove

public E remove()
Description copied from interface: BiIteratorI
Removes the current item.

Specified by:
remove in interface BiIteratorI<E>