org.eigenbase.runtime
Class QueueIteratorTest.TickIterator

java.lang.Object
  extended by org.eigenbase.runtime.QueueIteratorTest.TickIterator
All Implemented Interfaces:
Iterator
Enclosing class:
QueueIteratorTest

private static class QueueIteratorTest.TickIterator
extends Object
implements Iterator

Iterator which returns an element from an array on a regular basis.

Every clock tick until the array is exhausted, hasNext() returns true, then the following clock tick, next() returns an object. If you call a method too early, the method waits until the appropriate time.


Field Summary
private  int current
           
private  long startTime
           
private  Object[] values
           
private  boolean verbose
           
 
Constructor Summary
QueueIteratorTest.TickIterator(Object[] values, boolean verbose, long startTime)
           
 
Method Summary
static void demo()
           
 boolean hasNext()
           
 Object next()
           
 void remove()
           
private  void waitUntil(int tick)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verbose

private final boolean verbose

startTime

private final long startTime

current

private int current

values

private final Object[] values
Constructor Detail

QueueIteratorTest.TickIterator

QueueIteratorTest.TickIterator(Object[] values,
                               boolean verbose,
                               long startTime)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

waitUntil

private void waitUntil(int tick)

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

demo

public static void demo()