org.shapelogic.mathematics
Class PrimeNumberStream

java.lang.Object
  extended by org.shapelogic.streams.BaseListCommonStream<E>
      extended by org.shapelogic.streams.BaseListStream0<java.lang.Integer>
          extended by org.shapelogic.mathematics.PrimeNumberStream
All Implemented Interfaces:
java.lang.Iterable<java.lang.Integer>, java.util.Iterator<java.lang.Integer>, CalcValue<java.lang.Integer>, ContextGettable, LazyCalc<java.lang.Integer>, RecursiveContext, IndexedInputStream0<java.lang.Integer>, ListStream<java.lang.Integer>, NumberedStream<java.lang.Integer>, Stream<java.lang.Integer>, StreamProperties

public class PrimeNumberStream
extends BaseListStream0<java.lang.Integer>

Generated Prime Number.

Should this be based on a BaseListStream, when there is no input?
Probably not.
How should they be generated?
I could say start by last number and add until you get one that does not have any of the previous as divisors.
There can be a 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.BaseListCommonStream
_context, _current, _dirty, _last, _list, _maxLast, _name, _nullLegalValue, _parentContext, _query, _value
 
Constructor Summary
PrimeNumberStream()
           
PrimeNumberStream(int maxLast)
           
 
Method Summary
 java.lang.Integer invoke(int index)
          Closure to calculated 1 individual element based on index and input for the same index.
 
Methods inherited from class org.shapelogic.streams.BaseListStream0
getList, invokeIndex, setList
 
Methods inherited from class org.shapelogic.streams.BaseListCommonStream
calcAddNext, get, getContext, getCurrentSize, getInContext, getIndex, getLast, getMaxLast, getName, getParentContext, getValue, hasNext, hasNextBase, isCached, isDeterministic, isDirty, isNullLegalValue, isRandomAccess, iterator, next, 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

PrimeNumberStream

public PrimeNumberStream()

PrimeNumberStream

public PrimeNumberStream(int maxLast)
Method Detail

invoke

public java.lang.Integer invoke(int index)
Description copied from interface: IndexedInputStream0
Closure to calculated 1 individual element based on index and input for the same index. Should later just call the invoke on the closure. Maybe this should be moved up later.

Parameters:
index - of element in list


Copyright © 2008. All Rights Reserved.