pl.clareo.coroutines.user
Interface Controler<E,A>

All Known Implementing Classes:
StaticPattern

public interface Controler<E,A>

Interface used to control coroutine's execution. Its purpose is to further decouple coroutine's caller (client of CoIterator) from the coroutine's logic. Caller may use CoIterator.with(Controler) method and consume results without burden of sending appropriate values to underlying coroutine - this task being imposed on this Controler

Author:
Marcin Rzeźnicki

Method Summary
 void closed()
          Called when coroutine has been closed
 A init()
          Generate value sent to coroutine on the first yield
 void noNextElement()
          Called when coroutine has been closed because it was unable to generate more results
 A respondTo(E produced)
          Generates the next value sent to coroutine after some yield has generated produced
 

Method Detail

closed

void closed()
Called when coroutine has been closed


init

A init()
Generate value sent to coroutine on the first yield

Returns:
value to be sent to coroutine

noNextElement

void noNextElement()
Called when coroutine has been closed because it was unable to generate more results


respondTo

A respondTo(E produced)
            throws java.lang.IllegalStateException
Generates the next value sent to coroutine after some yield has generated produced

Parameters:
produced - last yielded value
Returns:
value to be sent to coroutine
Throws:
java.lang.IllegalStateException - Controler may throw this exception to forcibly close underlying coroutine


Copyright © 2010 CLAREO. All Rights Reserved.