cz.cuni.amis.utils.iterators
Class CircularIterator<E>

java.lang.Object
  extended by cz.cuni.amis.utils.iterators.CircularIterator<E>
Type Parameters:
E - contents of the iterable
All Implemented Interfaces:
java.util.Iterator<E>
Direct Known Subclasses:
ShiftedCircularIterator

public class CircularIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

Implements a circular iterator that iterates over any reasonable iterable instance. Not fully tested!


Field Summary
protected  boolean passedEnd
           
 
Constructor Summary
CircularIterator(java.lang.Iterable<E> toIterateOver)
           
 
Method Summary
protected  java.lang.Iterable<E> getIterable()
           
protected  java.util.Iterator<E> getIterator()
           
 boolean hasNext()
           
 boolean hasPassedEnd()
           
 E next()
           
 void remove()
           
protected  void restartIterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

passedEnd

protected boolean passedEnd
Constructor Detail

CircularIterator

public CircularIterator(java.lang.Iterable<E> toIterateOver)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<E>

next

public E next()
Specified by:
next in interface java.util.Iterator<E>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<E>

hasPassedEnd

public boolean hasPassedEnd()

getIterable

protected java.lang.Iterable<E> getIterable()

getIterator

protected java.util.Iterator<E> getIterator()

restartIterator

protected void restartIterator()