gnu.lists

Class GeneralArray

public class GeneralArray extends AbstractSequence implements Array

A class to handle general multi-dimensional arrays. This class is unfinished. If the number of dimensions (the "rank") is one, should use a class that implements Sequence. GeneralArray uses a SimpleVector 'base' to store the actual data, and provides general linear mapping from the array indexes to an element index in the 'base' SimpleVector. Thus such uperations as transposing an array can be implement as just creating a simple re-mapping of the indexes.
Constructor Summary
GeneralArray()
GeneralArray(int[] dimensions)
Method Summary
intcreatePos(int index, boolean isAfter)
Objectget(int index)
Objectget(int[] indexes)
intgetEffectiveIndex(int[] indexes)
Calculate corresponding index in base array.
intgetLowBound(int dim)
ObjectgetRowMajor(int index)
intgetSize(int dim)
static ArraymakeSimple(int[] lowBounds, int[] dimensions, SimpleVector base)
intrank()
Objectset(int[] indexes, Object value)
intsize()
See java.util.Collection.
static voidtoString(Array array, StringBuffer sbuf)
StringtoString()
Arraytranspose(int[] lowBounds, int[] dimensions, int offset0, int[] factors)

Constructor Detail

GeneralArray

public GeneralArray()

GeneralArray

public GeneralArray(int[] dimensions)

Method Detail

createPos

public int createPos(int index, boolean isAfter)

get

public Object get(int index)

get

public Object get(int[] indexes)

getEffectiveIndex

public int getEffectiveIndex(int[] indexes)
Calculate corresponding index in base array.

getLowBound

public int getLowBound(int dim)

getRowMajor

public Object getRowMajor(int index)

getSize

public int getSize(int dim)

makeSimple

public static Array makeSimple(int[] lowBounds, int[] dimensions, SimpleVector base)

rank

public int rank()

set

public Object set(int[] indexes, Object value)

size

public int size()
See java.util.Collection.

toString

public static void toString(Array array, StringBuffer sbuf)

toString

public String toString()

transpose

public Array transpose(int[] lowBounds, int[] dimensions, int offset0, int[] factors)