org.shapelogic.streams
Class WrappedListStream<E>

java.lang.Object
  extended by org.shapelogic.streams.BaseCommonStream<E>
      extended by org.shapelogic.streams.BaseListCommonStream<E>
          extended by org.shapelogic.streams.WrappedListStream<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 WrappedListStream<E>
extends BaseListCommonStream<E>

Wraps a stream around a list.

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
WrappedListStream(java.util.List<E> inputList)
           
WrappedListStream(java.util.List<E> inputList, java.lang.String name, RecursiveContext recursiveContext)
           
 
Method Summary
 E get(int index)
          Get next element without advancing _current.
 boolean hasNext()
           
 E invokeIndex(int index)
          Calculate the value at an index.
 
Methods inherited from class org.shapelogic.streams.BaseListCommonStream
calcAddNext, 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
 

Constructor Detail

WrappedListStream

public WrappedListStream(java.util.List<E> inputList)

WrappedListStream

public WrappedListStream(java.util.List<E> inputList,
                         java.lang.String name,
                         RecursiveContext recursiveContext)
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>

get

public E get(int index)
Description copied from class: BaseListCommonStream
Get next element without advancing _current.

Specified by:
get in interface NumberedStream<E>
Overrides:
get in class BaseListCommonStream<E>
Returns:

hasNext

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


Copyright © 2009. All Rights Reserved.