org.shapelogic.mathematics
Class NaturalNumberStream

java.lang.Object
  extended by org.shapelogic.streams.BaseCommonStream<E>
      extended by org.shapelogic.streams.BaseCommonNumberedStream<java.lang.Integer>
          extended by org.shapelogic.mathematics.NaturalNumberStream
All Implemented Interfaces:
java.util.Iterator<java.lang.Integer>, CalcValue<java.lang.Integer>, ContextGettable, LazyCalc<java.lang.Integer>, RecursiveContext, NumberedStream<java.lang.Integer>, Stream<java.lang.Integer>, StreamProperties

public class NaturalNumberStream
extends BaseCommonNumberedStream<java.lang.Integer>

Generated Natural Number. There can be both a start and stop value:
start index default 0

max last / last number default not set

Author:
Sami Badawi

Field Summary
 
Fields inherited from class org.shapelogic.streams.BaseCommonStream
_context, _current, _dirty, _last, _maxLast, _name, _nullLegalValue, _parentContext, _query, _value
 
Constructor Summary
NaturalNumberStream()
           
NaturalNumberStream(int maxLast)
           
NaturalNumberStream(int startIndex, java.lang.Integer maxLast)
           
 
Method Summary
 int getStartIndex()
           
 java.lang.Integer invokeIndex(int index)
          Calculate the value at an index.
 
Methods inherited from class org.shapelogic.streams.BaseCommonNumberedStream
calcAddNext, get, hasNext, hasNextBase, isCached, isRandomAccess, next, setLast
 
Methods inherited from class org.shapelogic.streams.BaseCommonStream
getContext, getInContext, getIndex, getLast, getMaxLast, getName, getParentContext, getValue, isDeterministic, isDirty, isNullLegalValue, remove, setLastFromInput, setMaxLast, setNullLegalValue, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalNumberStream

public NaturalNumberStream()

NaturalNumberStream

public NaturalNumberStream(int maxLast)

NaturalNumberStream

public NaturalNumberStream(int startIndex,
                           java.lang.Integer maxLast)
Method Detail

getStartIndex

public int getStartIndex()

invokeIndex

public java.lang.Integer invokeIndex(int index)
Description copied from class: BaseCommonNumberedStream
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 BaseCommonNumberedStream<java.lang.Integer>


Copyright © 2009. All Rights Reserved.