Package org.onlab.util
Class Generator<T>
- java.lang.Object
-
- org.onlab.util.Generator<T>
-
- Type Parameters:
T
- type of the object.
- All Implemented Interfaces:
java.lang.Iterable<T>
public abstract class Generator<T> extends java.lang.Object implements java.lang.Iterable<T>
Generator class that yields instances of T type objects as soon as they are ready.
-
-
Constructor Summary
Constructors Constructor Description Generator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<T>
iterator()
protected abstract void
run()
void
yield(T element)
Makes available the next item.
-
-
-
Method Detail
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
run
protected abstract void run() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
yield
public void yield(T element) throws java.lang.InterruptedException
Makes available the next item.- Parameters:
element
- the next item- Throws:
java.lang.InterruptedException
- if await fails
-
-