net.sf.staccatocommons.iterators.delayed
Class DelayedSingleIterator<A>

java.lang.Object
  extended by net.sf.staccatocommons.iterators.AbstractUnmodifiableIterator<A>
      extended by net.sf.staccatocommons.iterators.thriter.AbstractThriterator<A>
          extended by net.sf.staccatocommons.iterators.thriter.AdvanceThriterator<A>
              extended by net.sf.staccatocommons.iterators.SingleThriterator<A>
                  extended by net.sf.staccatocommons.iterators.delayed.DelayedSingleIterator<A>
All Implemented Interfaces:
Iterator<A>, EmptyAware, Thriter<A>, Thriterator<A>

public class DelayedSingleIterator<A>
extends SingleThriterator<A>

Author:
flbulgarelli

Constructor Summary
DelayedSingleIterator(Thunk<A> element)
          Creates a new DelayedSingleIterator
 
Method Summary
 A current()
          Answers element at the current position of this Thriter.
 Thunk<A> delayedCurrent()
          Answers a Thunk that, when evaluated through Thunk.value(), will return the current element of this Thriter at the time of being Thriter.delayedCurrent() sent.
 
Methods inherited from class net.sf.staccatocommons.iterators.SingleThriterator
advanceNext, hasNext, toString
 
Methods inherited from class net.sf.staccatocommons.iterators.thriter.AdvanceThriterator
next
 
Methods inherited from class net.sf.staccatocommons.iterators.thriter.AbstractThriterator
delayedNext, isEmpty
 
Methods inherited from class net.sf.staccatocommons.iterators.AbstractUnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
remove
 

Constructor Detail

DelayedSingleIterator

public DelayedSingleIterator(@NonNull
                             Thunk<A> element)
Creates a new DelayedSingleIterator

Method Detail

current

public A current()
          throws NoSuchElementException
Description copied from interface: Thriter
Answers element at the current position of this Thriter. Result of this method if Thriter.advanceNext() was never evaluated before is undefined.

Specified by:
current in interface Thriter<A>
Overrides:
current in class SingleThriterator<A>
Returns:
the current element
Throws:
NoSuchElementException

delayedCurrent

public Thunk<A> delayedCurrent()
Description copied from interface: Thriter
Answers a Thunk that, when evaluated through Thunk.value(), will return the current element of this Thriter at the time of being Thriter.delayedCurrent() sent. This means, that the value of the returned thunk must must always equals, even if this Thriter was advanced later.

Specified by:
delayedCurrent in interface Thriter<A>
Overrides:
delayedCurrent in class AbstractThriterator<A>
Returns:
a Thunk tha provides Thriter.current() at the time of this message being sent.


Get Staccatocommons at SourceForge.net. Fast, secure and Free Open Source software downloads