org.shapelogic.streams
Class SingleListStream<T>

java.lang.Object
  extended by org.shapelogic.streams.BaseCommonStream<E>
      extended by org.shapelogic.streams.BaseListCommonStream<T>
          extended by org.shapelogic.streams.SingleListStream<T>
Type Parameters:
T -
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Iterator<T>, Calc0<T>, CalcInvoke<T>, CalcValue<T>, ContextGettable, LazyCalc<T>, RecursiveContext, ListStream<T>, NumberedStream<T>, Stream<T>, StreamProperties
Direct Known Subclasses:
SVGReader

public abstract class SingleListStream<T>
extends BaseListCommonStream<T>
implements CalcInvoke<T>, ListStream<T>

Use this to treat a calculation as a stream.

Author:
Sami Badawi

Field Summary
 
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
SingleListStream()
           
 
Method Summary
 T getValue()
          Starts a lazy calculation.
 T invokeIndex(int index)
          Calculate the value at an index.
 
Methods inherited from class org.shapelogic.streams.BaseListCommonStream
calcAddNext, get, getCurrentSize, getList, hasNext, hasNextBase, isCached, isRandomAccess, iterator, next, setLastFromInput, setList
 
Methods inherited from class org.shapelogic.streams.BaseCommonStream
getContext, getInContext, getIndex, getLast, getMaxLast, getName, getParentContext, 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.calculation.Calc0
invoke
 
Methods inherited from interface org.shapelogic.streams.ListStream
getList, setList
 
Methods inherited from interface org.shapelogic.streams.NumberedStream
get, getIndex, getLast, getMaxLast, setMaxLast
 
Methods inherited from interface org.shapelogic.calculation.LazyCalc
isDirty, setup
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

SingleListStream

public SingleListStream()
Method Detail

invokeIndex

public T 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<T>

getValue

public T getValue()
Description copied from interface: CalcValue
Starts a lazy calculation. If dirty do calc() else return cached value. This should maybe be moved up in the hierarchy

Specified by:
getValue in interface CalcValue<T>
Overrides:
getValue in class BaseCommonStream<T>


Copyright © 2009. All Rights Reserved.