|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- type of elements returned by coroutineA
- type of elements sent to coroutinepublic interface CoIterator<E,A>
Interface encapsulating coroutine execution
Method Summary | |
---|---|
void |
callWithPattern(A... toSend)
As withPattern(Object...) but handy if you do not expect
results. |
void |
close()
Informs coroutine that no more operations will be performed. |
java.lang.Iterable<E> |
each()
results of coroutine as Iterable . |
E |
next()
Obtains next result from coroutine |
E |
send(A a)
Obtains next result from coroutine and sends a to coroutine
(in corutine a will become current
yield result) |
java.lang.Iterable<E> |
till(E e)
results of coroutine as Iterable . |
java.lang.Iterable<E> |
till(ExitCondition<E> condition)
results of coroutine as Iterable . |
java.lang.Iterable<E> |
till(int count)
results of coroutine as Iterable . |
java.lang.Iterable<E> |
with(Controler<E,A> controler)
results of coroutine as Iterable . |
java.lang.Iterable<E> |
withPattern(A... toSend)
results of coroutine as Iterable . |
Method Detail |
---|
void callWithPattern(A... toSend)
withPattern(Object...)
but handy if you do not expect
results. It calls resulting Iterable
till exhaustion and returns
toSend
- parameters sent to coroutinevoid close()
CoroutineExitException
. Further calls to coroutine
result in CoroutineClosedException
in caller. All calls to close
after the first one make no effect
java.lang.Iterable<E> each()
Iterable
. Iterator of result
Iterable
will return false
from its
hasNext
method after coroutine throws
NoSuchElementException
or after it has been closed
Iterable
E next()
CoroutineClosedException
- if coroutine has been closedE send(A a)
a
to coroutine
(in corutine a
will become current
yield
result)
a
- result of yield
in coroutine
CoroutineClosedException
- if coroutine has been closedjava.lang.Iterable<E> till(E e)
Iterable
. Iterator of result
Iterable
will return false
from its
hasNext
method after coroutine throws
NoSuchElementException
, after it has been closed or after last
returned element is equals to e
(or null
if
e
is null
). Coroutine is closed when this
Iterable
ends
e
- element marking end of iteration (may be null
)
Iterable
java.lang.Iterable<E> till(ExitCondition<E> condition)
Iterable
. Iterator of result
Iterable
will return false
from its
hasNext
method after coroutine throws
NoSuchElementException
, after it has been closed or after
condition
evaluates to true
. Coroutine is
closed when this Iterable
ends
condition
- condition evaluated whenever coroutine yields
Iterable
java.lang.Iterable<E> till(int count)
Iterable
. Iterator of result
Iterable
will return false
from its
hasNext
method after coroutine throws
NoSuchElementException
, after it has been closed or after it has
been called count
times. Coroutine is closed when this
Iterable
ends
count
- number of desired results from coroutine
Iterable
java.lang.Iterable<E> with(Controler<E,A> controler)
Iterable
. Coroutine is controled by
Controler
instance passed to this method. Coroutine is closed
when this Iterable
ends
controler
- coroutine's controler
Iterable
java.lang.Iterable<E> withPattern(A... toSend)
Iterable
. Each result is obtained by
calling send
method. Parameters passed to
send
method are taken from toSend
array in
sequence. Coroutine is closed when this Iterable
ends
toSend
- parameters sent to coroutine
Iterable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |