org.shapelogic.calculation
Class CartesianIndex2

java.lang.Object
  extended by org.shapelogic.calculation.CartesianIndex2
All Implemented Interfaces:
java.util.Iterator<int[]>, CalcValue<int[]>, CartesianIndex, LazyCalc<int[]>, NumberedStream<int[]>, Stream<int[]>

public class CartesianIndex2
extends java.lang.Object
implements CartesianIndex

CartesianIndex2 creates an accessing scheme for 2 NumberedStream, List or Array.

Author:
Sami Badawi

Field Summary
protected  boolean _dirty
           
protected  int[] _lengths
           
protected  int[] _start
          _start is the start value of a dimension.
protected  int[] _stop
          _stop is the start value of a dimension.
protected  int[] _value
          _value is the current index.
 
Constructor Summary
CartesianIndex2(java.util.List list0, java.util.List list1)
           
CartesianIndex2(NumberedStream numberedStream0, NumberedStream numberedStream1)
           
CartesianIndex2(java.lang.Object[] array0, java.lang.Object[] array1)
           
 
Method Summary
 int[] get(int index)
          Get the calculate value for index based on the previous stream So it just calls invoke(getInputStream().get(index), index)
 int getDimension()
           
 int getIndex()
          Index of last successfully processed element.
 int getLast()
          Last possible element.
 int[] getLastNumbers()
           
 int getMaxLast()
          Set a max value for last possible element.
 int[] getStartNumbers()
           
 int[] getValue()
          Starts a lazy calculation.
 boolean hasNext()
           
 boolean isDirty()
          When dirty is false that means that the calculated value can be used
 int[] next()
           
 void remove()
           
 void setMaxLast(int maxLast)
          Set a max value for last possible element.
 void setup()
          If there are cases where you know the start and stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_value

protected int[] _value
_value is the current index.


_start

protected int[] _start
_start is the start value of a dimension.


_stop

protected int[] _stop
_stop is the start value of a dimension.


_lengths

protected int[] _lengths

_dirty

protected boolean _dirty
Constructor Detail

CartesianIndex2

public CartesianIndex2(NumberedStream numberedStream0,
                       NumberedStream numberedStream1)

CartesianIndex2

public CartesianIndex2(java.util.List list0,
                       java.util.List list1)

CartesianIndex2

public CartesianIndex2(java.lang.Object[] array0,
                       java.lang.Object[] array1)
Method Detail

setup

public void setup()
If there are cases where you know the start and stop.

Specified by:
setup in interface LazyCalc<int[]>

get

public int[] get(int index)
Description copied from interface: NumberedStream
Get the calculate value for index based on the previous stream So it just calls invoke(getInputStream().get(index), index)

Specified by:
get in interface NumberedStream<int[]>
Returns:

getDimension

public int getDimension()
Specified by:
getDimension in interface CartesianIndex

getLastNumbers

public int[] getLastNumbers()
Specified by:
getLastNumbers in interface CartesianIndex

getStartNumbers

public int[] getStartNumbers()
Specified by:
getStartNumbers in interface CartesianIndex

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<int[]>

next

public int[] next()
Specified by:
next in interface java.util.Iterator<int[]>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<int[]>

isDirty

public boolean isDirty()
Description copied from interface: LazyCalc
When dirty is false that means that the calculated value can be used

Specified by:
isDirty in interface LazyCalc<int[]>

getValue

public int[] getValue()
Description copied from interface: CalcValue
Starts a lazy calculation. If dirty do calc() else return cached value. This should maybe be moved up in the hierarchy

Specified by:
getValue in interface CalcValue<int[]>

getIndex

public int getIndex()
Description copied from interface: NumberedStream
Index of last successfully processed element.

Specified by:
getIndex in interface NumberedStream<int[]>

getLast

public int getLast()
Description copied from interface: NumberedStream
Last possible element.

Specified by:
getLast in interface NumberedStream<int[]>

getMaxLast

public int getMaxLast()
Description copied from interface: NumberedStream
Set a max value for last possible element.

Specified by:
getMaxLast in interface NumberedStream<int[]>

setMaxLast

public void setMaxLast(int maxLast)
Description copied from interface: NumberedStream
Set a max value for last possible element.

Specified by:
setMaxLast in interface NumberedStream<int[]>


Copyright © 2008. All Rights Reserved.