|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.shapelogic.streams.BaseListCommonStream<E> org.shapelogic.streams.BaseListStream2<In0,In1,E>
public abstract class BaseListStream2<In0,In1,E>
Implementation of ListStream.
Close to
1: a lazy stream.
2: a UNIX pipe.
This is close to org.apache.commons.collections.list.LazyList,
but that takes a factory to calculate next element, and that works badly here.
How should a step work?
Normally call the hasNext, in order for this to work it would have to do the
calculation.
So _current should be the last element that has been returned.
So when you call hasNext it will add that element to the list.
When you call next it will bump the counter up one element if goes too high
then do the calculation.
At the end it will get to a point where the calculation fails.
At that point last will be set to the current element.
I will ignore synchronization to begin with.
Field Summary | |
---|---|
protected CartesianIndex |
_cartesianIndex
|
protected NumberedStream<In0> |
_inputStream0
|
protected NumberedStream<In1> |
_inputStream1
|
Fields inherited from class org.shapelogic.streams.BaseListCommonStream |
---|
_contexts, _current, _dirty, _last, _list, _maxLast, _name, _query, _value |
Constructor Summary | |
---|---|
BaseListStream2(NumberedStream<In0> inputStream0,
NumberedStream<In1> inputStream1)
|
|
BaseListStream2(NumberedStream<In0> inputStream0,
NumberedStream<In1> inputStream1,
int maxLast)
|
Method Summary | |
---|---|
boolean |
calcAddNext()
Try to calculate one more, independent of the _current. |
In0 |
getInput0(int index)
Get numbered element from InputStream |
In1 |
getInput1(int index)
|
NumberedStream<In0> |
getInputStream0()
Stream that this stream is connected to. |
NumberedStream<In1> |
getInputStream1()
|
boolean |
hasNext()
|
abstract E |
invoke(In0 input0,
In1 input1,
int index)
Calculate the next value |
E |
invokeIndex(int index)
Calculate the value at an index. |
Methods inherited from class org.shapelogic.streams.BaseListCommonStream |
---|
get, getContext, getContexts, getCurrentSize, getInContext, getIndex, getLast, getList, getMaxLast, getName, getValue, hasNextBase, isCached, isContextBased, isDeterministic, isDirty, isRandomAccess, iterator, next, remove, setList, setMaxLast, setup |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final NumberedStream<In0> _inputStream0
protected final NumberedStream<In1> _inputStream1
protected final CartesianIndex _cartesianIndex
Constructor Detail |
---|
public BaseListStream2(NumberedStream<In0> inputStream0, NumberedStream<In1> inputStream1, int maxLast)
public BaseListStream2(NumberedStream<In0> inputStream0, NumberedStream<In1> inputStream1)
Method Detail |
---|
public abstract E invoke(In0 input0, In1 input1, int index)
invoke
in interface IndexedInputStream2<In0,In1,E>
index
- of element in list
public E invokeIndex(int index)
BaseListCommonStream
invokeIndex
in class BaseListCommonStream<E>
public boolean hasNext()
hasNext
in interface java.util.Iterator<E>
hasNext
in class BaseListCommonStream<E>
public boolean calcAddNext()
calcAddNext
in class BaseListCommonStream<E>
public In0 getInput0(int index)
IndexedInputStream2
getInput0
in interface IndexedInputStream2<In0,In1,E>
public In1 getInput1(int index)
getInput1
in interface IndexedInputStream2<In0,In1,E>
public NumberedStream<In0> getInputStream0()
IndexedInputStream2
getInputStream0
in interface IndexedInputStream2<In0,In1,E>
public NumberedStream<In1> getInputStream1()
getInputStream1
in interface IndexedInputStream2<In0,In1,E>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |