org.shapelogic.streams
Class IteratorStream<E>

java.lang.Object
  extended by org.shapelogic.streams.BaseListCommonStream<E>
      extended by org.shapelogic.streams.IteratorStream<E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Iterator<E>, CalcValue<E>, ContextGettable, LazyCalc<E>, RecursiveContext, ListStream<E>, NumberedStream<E>, Stream<E>, StreamProperties

public class IteratorStream<E>
extends BaseListCommonStream<E>

Stream based on Iterator that can be set.

Author:
Sami Badawi

Field Summary
protected  java.util.Iterator<E> _iterator
           
 
Fields inherited from class org.shapelogic.streams.BaseListCommonStream
_context, _current, _dirty, _last, _list, _maxLast, _name, _nullLegalValue, _parentContext, _query, _value
 
Constructor Summary
IteratorStream(java.util.Iterator<E> iterator)
           
IteratorStream(java.util.Iterator<E> iterator, int maxLast)
           
 
Method Summary
 java.util.Iterator<E> getIterator()
           
 boolean hasNext()
           
 E invokeIndex(int index)
          Calculate the value at an index.
 void setIterator(java.util.Iterator<E> iterator)
           
 
Methods inherited from class org.shapelogic.streams.BaseListCommonStream
calcAddNext, get, getContext, getCurrentSize, getInContext, getIndex, getLast, getList, getMaxLast, getName, getParentContext, getValue, hasNextBase, isCached, isDeterministic, isDirty, isNullLegalValue, isRandomAccess, iterator, next, remove, setLastFromInput, setList, setMaxLast, setNullLegalValue, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_iterator

protected java.util.Iterator<E> _iterator
Constructor Detail

IteratorStream

public IteratorStream(java.util.Iterator<E> iterator,
                      int maxLast)

IteratorStream

public IteratorStream(java.util.Iterator<E> iterator)
Method Detail

invokeIndex

public E invokeIndex(int index)
Description copied from class: BaseListCommonStream
Calculate the value at an index.
So it gets the needed input value and call the appropriate invoke function.
Can this be used for a filter call?
The index does not make sense for a filter since you do not know where the input is coming from. So maybe just ignore it.
This is a little messy but less messy that what is there now.

Specified by:
invokeIndex in class BaseListCommonStream<E>

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<E>
Overrides:
hasNext in class BaseListCommonStream<E>

getIterator

public java.util.Iterator<E> getIterator()

setIterator

public void setIterator(java.util.Iterator<E> iterator)


Copyright © 2008. All Rights Reserved.