org.shapelogic.streams
Class IteratorStream<E>

java.lang.Object
  extended by org.shapelogic.streams.BaseCommonStream<E>
      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
_list
 
Fields inherited from class org.shapelogic.streams.BaseCommonStream
_context, _current, _dirty, _last, _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, getCurrentSize, getList, hasNextBase, isCached, isRandomAccess, iterator, next, setLastFromInput, setList
 
Methods inherited from class org.shapelogic.streams.BaseCommonStream
getContext, getInContext, getIndex, getLast, getMaxLast, getName, getParentContext, getValue, isDeterministic, isDirty, isNullLegalValue, remove, setMaxLast, setNullLegalValue, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.shapelogic.streams.NumberedStream
getIndex, getLast, getMaxLast, setMaxLast
 
Methods inherited from interface org.shapelogic.calculation.LazyCalc
isDirty, setup
 
Methods inherited from interface org.shapelogic.calculation.CalcValue
getValue
 
Methods inherited from interface java.util.Iterator
remove
 

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 © 2009. All Rights Reserved.