|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectde.matthiasmann.continuations.CoIterator<E>
public abstract class CoIterator<E>
A Coroutine based iterator
| Constructor Summary | |
|---|---|
protected |
CoIterator()
|
| Method Summary | |
|---|---|
boolean |
hasNext()
|
E |
next()
|
protected void |
produce(E element)
Produces the next value to be returned by the next() method. |
void |
remove()
Always throws UnsupportedOperationException. |
protected abstract void |
run()
This is the body of the Iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected CoIterator()
| Method Detail |
|---|
public boolean hasNext()
hasNext in interface java.util.Iterator<E>public E next()
next in interface java.util.Iterator<E>
public void remove()
throws java.lang.UnsupportedOperationException
remove in interface java.util.Iterator<E>java.lang.UnsupportedOperationException - always
protected void produce(E element)
throws SuspendExecution
next() method.
element - The value that should be returned by next()
SuspendExecution - This method will suspend the execution
protected abstract void run()
throws SuspendExecution
This is the body of the Iterator. This method is executed as a
Coroutine to produce(E) the values of the Iterator.
Note that this method is suspended each time it calls produce. And if the consumer does not consume all values of the Iterator then this method does not get the change to finish it's execution. This also includes the finally blocks.
This method must only suspend by calling produce. Any other reason for suspension will cause a busy loop in the Iterator.
SuspendExecution
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||