csheets.ext.assertion
Class ConstMultiIntervalIterator

java.lang.Object
  extended by csheets.ext.assertion.ConstMultiIntervalIterator
All Implemented Interfaces:
Iterator<Interval>

public class ConstMultiIntervalIterator
extends Object
implements Iterator<Interval>

An iterator wrapper used by MultiInterval to be able to expose the intervals contained in the MultiInterval without allowing the user to modify the underlying collection directly.

Author:
Peter Palotas

Constructor Summary
protected ConstMultiIntervalIterator(Iterator<Interval> iter)
          Creates a new "const"-iterator using the iterator specified for all operations except remove.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 Interval next()
          Returns the next element in the iteration.
 void remove()
          Throws UnsupportedOperationException since this iterator does not allow modification of the unerlying collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstMultiIntervalIterator

protected ConstMultiIntervalIterator(Iterator<Interval> iter)
Creates a new "const"-iterator using the iterator specified for all operations except remove.

Parameters:
iter - the iterator to use for iteration.
Method Detail

hasNext

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

Specified by:
hasNext in interface Iterator<Interval>
Returns:
true if the iterator has more elements, false otherwise.

next

public Interval next()
Returns the next element in the iteration. Calling this method repeatedly until the hasNext() method returns false will return each element in the underlying collection exactly once.

Specified by:
next in interface Iterator<Interval>
Returns:
the next element in the iteration.
Throws:
NoSuchElementException - iteration has no more elements.

remove

public void remove()
Throws UnsupportedOperationException since this iterator does not allow modification of the unerlying collection.

Specified by:
remove in interface Iterator<Interval>
Throws:
UnsupportedOperationException - whenever called.