edu.cmu.cs.coral.icf.plan_based.planners.pip
Class ReverseListIterator

java.lang.Object
  |
  +--edu.cmu.cs.coral.icf.plan_based.planners.pip.ReverseListIterator

public class ReverseListIterator
extends java.lang.Object
implements java.util.ListIterator

An iterator that iterates in reverse order.

Since:
ICF 0.0
Version:
$Id$

Field Summary
private  java.util.ListIterator listIter
           
 
Constructor Summary
ReverseListIterator(java.util.List list)
          Construct a reverse iterator starting at the end of the list.
ReverseListIterator(java.util.ListIterator iter)
          Construct a reverse iterator starting at the same location as this iterator.
 
Method Summary
 void add(java.lang.Object o)
          Inserts the object into the list.
 boolean hasNext()
          Checks if the iterator has a next element
 boolean hasPrevious()
          Checks if the iterator has a previous element
 java.lang.Object next()
          Gets the next element of the list in reverse order.
 int nextIndex()
          Gets the index of the element that will be returned by the next call to next.
 java.lang.Object previous()
          Gets the previous element of the list in reverse order.
 int previousIndex()
          Gets the index of the element that will be returned by the previous call to previous.
 void remove()
          Removes the element at the current position.
 void set(java.lang.Object o)
          Replaces the element at the current position with the given object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

listIter

private java.util.ListIterator listIter
Constructor Detail

ReverseListIterator

public ReverseListIterator(java.util.List list)
Construct a reverse iterator starting at the end of the list.
Parameters:
list - the list to construct the reverse iterator for
Since:
ICF 0.0

ReverseListIterator

public ReverseListIterator(java.util.ListIterator iter)
Construct a reverse iterator starting at the same location as this iterator.
Parameters:
iter - the iterator to reverse the direction of
Since:
ICF 0.0
Method Detail

add

public void add(java.lang.Object o)
Inserts the object into the list.
Specified by:
add in interface java.util.ListIterator
Parameters:
object - the object to insert
Since:
ICF 0.0

hasNext

public boolean hasNext()
Checks if the iterator has a next element
Specified by:
hasNext in interface java.util.ListIterator
Returns:
true if and only if the iterator has a next element
Since:
ICF 0.0

hasPrevious

public boolean hasPrevious()
Checks if the iterator has a previous element
Specified by:
hasPrevious in interface java.util.ListIterator
Returns:
true if and only if the iterator has a previous element
Since:
ICF 0.0

next

public java.lang.Object next()
Gets the next element of the list in reverse order.
Specified by:
next in interface java.util.ListIterator
Returns:
the next element in reverse order
Since:
ICF 0.0

nextIndex

public int nextIndex()
Gets the index of the element that will be returned by the next call to next.
Specified by:
nextIndex in interface java.util.ListIterator
Returns:
the index of the next element
Since:
ICF 0.0

previous

public java.lang.Object previous()
Gets the previous element of the list in reverse order.
Specified by:
previous in interface java.util.ListIterator
Returns:
the previous element in reverse order
Since:
ICF 0.0

previousIndex

public int previousIndex()
Gets the index of the element that will be returned by the previous call to previous.
Specified by:
previousIndex in interface java.util.ListIterator
Returns:
the index of the previous element
Since:
ICF 0.0

remove

public void remove()
Removes the element at the current position.
Specified by:
remove in interface java.util.ListIterator
Since:
ICF 0.0

set

public void set(java.lang.Object o)
Replaces the element at the current position with the given object.
Specified by:
set in interface java.util.ListIterator
Parameters:
o - the new value for this element
Since:
ICF 0.0