org.shapelogic.streams
Class WrappedListStream<E>

java.lang.Object
  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
_context, _current, _dirty, _last, _list, _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, 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
 

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