org.shapelogic.streams
Class NamedListCalcStream1<In,E>

java.lang.Object
  extended by org.shapelogic.streams.BaseCommonStream<E>
      extended by org.shapelogic.streams.BaseListCommonStream<E>
          extended by org.shapelogic.streams.BaseListStream1<In,E>
              extended by org.shapelogic.streams.NamedListCalcStream1<In,E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Iterator<E>, Calc1<In,E>, CalcValue<E>, ContextGettable, LazyCalc<E>, RecursiveContext, InputStream1<In,E>, ListStream<E>, NumberedStream<E>, Stream<E>, StreamProperties

public class NamedListCalcStream1<In,E>
extends BaseListStream1<In,E>

Make a stream that is using a Calc1 class to do a calculation, based on a named input stream stored in a context.
Uses lazy setup so input stream does not have to exist when stream is created.
There should be a way to say whether you have to calculate all the values sequentially to use this.

Author:
Sami Badawi

Field Summary
protected  Calc1<In,E> _calc
           
protected static IQueryCalc _queryCalc
           
protected  boolean _setupRun
           
 
Fields inherited from class org.shapelogic.streams.BaseListStream1
_inputStream
 
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
NamedListCalcStream1()
           
NamedListCalcStream1(Calc1<In,E> calc, java.lang.String inputName, RecursiveContext context)
           
NamedListCalcStream1(Calc1<In,E> calc, java.lang.String inputName, RecursiveContext context, java.lang.String outputName)
           
NamedListCalcStream1(Calc1<In,E> calc, java.lang.String inputName, RecursiveContext recursiveContext, java.lang.String outputName, int maxLast)
           
 
Method Summary
 NumberedStream<In> getInputStream()
          Stream that this stream is connected to.
 E invoke(In input)
           
 void setCalc(Calc1<In,E> calc)
           
 void setup()
          Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.
 
Methods inherited from class org.shapelogic.streams.BaseListStream1
getInput, getList, invokeIndex, setLastFromInput, setList
 
Methods inherited from class org.shapelogic.streams.BaseListCommonStream
calcAddNext, get, getCurrentSize, hasNext, hasNextBase, isCached, isRandomAccess, iterator, next
 
Methods inherited from class org.shapelogic.streams.BaseCommonStream
getContext, getInContext, getIndex, getLast, getMaxLast, getName, getParentContext, getValue, isDeterministic, isDirty, isNullLegalValue, remove, setMaxLast, setNullLegalValue
 
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
 
Methods inherited from interface org.shapelogic.calculation.CalcValue
getValue
 
Methods inherited from interface java.util.Iterator
remove
 

Field Detail

_calc

protected Calc1<In,E> _calc

_queryCalc

protected static IQueryCalc _queryCalc

_setupRun

protected boolean _setupRun
Constructor Detail

NamedListCalcStream1

public NamedListCalcStream1(Calc1<In,E> calc,
                            java.lang.String inputName,
                            RecursiveContext recursiveContext,
                            java.lang.String outputName,
                            int maxLast)

NamedListCalcStream1

public NamedListCalcStream1(Calc1<In,E> calc,
                            java.lang.String inputName,
                            RecursiveContext context,
                            java.lang.String outputName)

NamedListCalcStream1

public NamedListCalcStream1(Calc1<In,E> calc,
                            java.lang.String inputName,
                            RecursiveContext context)

NamedListCalcStream1

public NamedListCalcStream1()
Method Detail

setup

public void setup()
Description copied from interface: LazyCalc
Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.

Specified by:
setup in interface LazyCalc<E>
Overrides:
setup in class BaseCommonStream<E>

invoke

public E invoke(In input)

getInputStream

public NumberedStream<In> getInputStream()
Description copied from interface: InputStream1
Stream that this stream is connected to. What if the Range is of different type? I think that maybe I can relax this later.

Specified by:
getInputStream in interface InputStream1<In,E>
Overrides:
getInputStream in class BaseListStream1<In,E>

setCalc

public void setCalc(Calc1<In,E> calc)


Copyright © 2009. All Rights Reserved.