com.infomancers.collections.yield
Class Yielder<T>

java.lang.Object
  extended by com.infomancers.collections.yield.Yielder<T>
All Implemented Interfaces:
java.lang.Iterable<T>

public abstract class Yielder<T>
extends java.lang.Object
implements java.lang.Iterable<T>

Abstract class from which all yielders extend.

When a sub-class implements the yieldNextCore method, during runtime it will be enhanced to the following:

1. All local variables within the yieldNextCore method will be promoted to class member fields. 2. A new member, "state" of type byte, will be added. 3. Each call to yieldReturn will have the following code appended to after it: state = [number]; return; Label[number]: 4. Each call to yieldBreak will have a return statement appended to it. 5. At the beginning of the method, a switch will be added containing a number of case branches equal to the number of yieldReturn calls, such as the following code: switch (state) { case [number]: goto Label[number]; .. }


Constructor Summary
Yielder()
           
 
Method Summary
 java.util.Iterator<T> iterator()
          Returns an iterator which goes through all elements returned using the yieldReturn method during a yieldNextCore implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Yielder

public Yielder()
Method Detail

iterator

public java.util.Iterator<T> iterator()
Returns an iterator which goes through all elements returned using the yieldReturn method during a yieldNextCore implementation.

Specified by:
iterator in interface java.lang.Iterable<T>
Returns:
An iterator for all yielded items of type T.