cetus.hir
Class IRIterator

java.lang.Object
  extended by cetus.hir.IRIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
BreadthFirstIterator, DepthFirstIterator, FlatIterator, PostOrderIterator

public abstract class IRIterator
extends java.lang.Object
implements java.util.Iterator

An iterator implementing this interface supports special versions of next.


Field Summary
protected  Traversable root
           
 
Constructor Summary
protected IRIterator(Traversable root)
           
 
Method Summary
protected  boolean containsCompatibleClass(java.util.Set<java.lang.Class> s, java.lang.Class c)
          Checks if s contains a superset of c.
abstract  boolean hasNext()
          Returns true if the iteration has more elements.
abstract  java.lang.Object next()
          Returns the next element in the iteration.
 java.lang.Object next(java.lang.Class c)
          Returns the next element in the iteration that is an instance of a certain class.
 java.lang.Object next(java.util.Set s)
          Returns the next element in the iteration that is an instance of a class in the set.
 java.lang.Object nextExcept(java.util.Set s)
          Returns the next element in the iteration that is not an instance of a class in the set.
 void remove()
          This operation is not supported.
abstract  void reset()
          Moves the iterator back to the beginning of the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected Traversable root
Constructor Detail

IRIterator

protected IRIterator(Traversable root)
Method Detail

containsCompatibleClass

protected boolean containsCompatibleClass(java.util.Set<java.lang.Class> s,
                                          java.lang.Class c)
Checks if s contains a superset of c.

Returns:
true if the Set s contains a Class object that is the same as or a superset of Class c, and false otherwise.

hasNext

public abstract boolean hasNext()
Returns true if the iteration has more elements. (In other words, returns true if a call to next would return an element rather than throwing an exception.)

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements.

next

public abstract java.lang.Object next()
Returns the next element in the iteration.

Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration.

next

public java.lang.Object next(java.lang.Class c)
                      throws java.util.NoSuchElementException
Returns the next element in the iteration that is an instance of a certain class.

Parameters:
c - The class of which the next element must be a instance.
Returns:
the next element that is of class c.
Throws:
java.util.NoSuchElementException - if there are no elements of class c.

next

public java.lang.Object next(java.util.Set s)
                      throws java.util.NoSuchElementException
Returns the next element in the iteration that is an instance of a class in the set.

Parameters:
s - A set of classes of which the next element must be an instance.
Returns:
the next element that is an instance of a class in s.
Throws:
java.util.NoSuchElementException - if there are no elements of classes in s.

nextExcept

public java.lang.Object nextExcept(java.util.Set s)
                            throws java.util.NoSuchElementException
Returns the next element in the iteration that is not an instance of a class in the set.

Parameters:
s - A set of classes of which the next element must not be an instance.
Returns:
the next element that is not an instance of a class in s.
Throws:
java.util.NoSuchElementException - if there are no elements that are not of classes in s.

remove

public void remove()
This operation is not supported.

Specified by:
remove in interface java.util.Iterator

reset

public abstract void reset()
Moves the iterator back to the beginning of the sequence.