shared.array
Class ObjectArray<T>

java.lang.Object
  extended by shared.array.ProtoArray<ObjectArray<T>,T[],T>
      extended by shared.array.ObjectArray<T>
Type Parameters:
T - the storage type.
All Implemented Interfaces:
Cloneable, Array<ObjectArray<T>,T>

public class ObjectArray<T>
extends ProtoArray<ObjectArray<T>,T[],T>

A multidimensional object array class.


Nested Class Summary
 
Nested classes/interfaces inherited from interface shared.array.Array
Array.IndexingOrder
 
Field Summary
 
Fields inherited from class shared.array.ProtoArray
dims, order, strides, values
 
Constructor Summary
  ObjectArray(Class<T> clazz, Array.IndexingOrder order, int... dims)
          Alternate constructor.
protected ObjectArray(Class<T> clazz, Array.IndexingOrder order, int[] dims, int[] strides)
          Internal constructor for package use only.
  ObjectArray(Class<T> clazz, int... dims)
          Default constructor.
protected ObjectArray(int unused, Class<T> clazz, Array.IndexingOrder order, int[] dims)
          Internal constructor with a distinctive signature.
protected ObjectArray(int unused, T[] values, Array.IndexingOrder order, int[] dims)
          Internal constructor with a distinctive signature.
  ObjectArray(ObjectArray<T> array)
          Alternate constructor.
  ObjectArray(T[] values, Array.IndexingOrder order, int... dims)
          Alternate constructor.
  ObjectArray(T[] values, int... dims)
          Alternate constructor.
 
Method Summary
 T get(int... s)
          Gets the value at the given logical index.
 byte[] getBytes()
          Converts this array into bytes.
 Class<T> getComponentType()
          Gets the component type.
 IntegerArray iSort(int dim)
          Sorts along the given dimension.
 void set(T value, int... s)
          Sets the value at the given logical index.
 String toString()
          Creates a human-readable representation of this array.
 T[] values()
          Gets the backing values.
protected  ObjectArray<T> wrap(Array.IndexingOrder order, int[] dims, int[] strides)
          Allocates a new array.
protected  ObjectArray<T> wrap(T value, Array.IndexingOrder order, int[] dims, int[] strides)
          Allocates a new array initialized to the given value.
 
Methods inherited from class shared.array.ProtoArray
clone, dimensions, map, ndims, order, physical, reshape, reverse, reverseOrder, shift, size, slice, slice, slice, slice, splice, stride, strides, subarray, tile, transpose
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectArray

public ObjectArray(Class<T> clazz,
                   int... dims)
Default constructor.


ObjectArray

public ObjectArray(Class<T> clazz,
                   Array.IndexingOrder order,
                   int... dims)
Alternate constructor.


ObjectArray

protected ObjectArray(int unused,
                      Class<T> clazz,
                      Array.IndexingOrder order,
                      int[] dims)
Internal constructor with a distinctive signature.


ObjectArray

public ObjectArray(T[] values,
                   int... dims)
Alternate constructor.


ObjectArray

public ObjectArray(T[] values,
                   Array.IndexingOrder order,
                   int... dims)
Alternate constructor.


ObjectArray

public ObjectArray(ObjectArray<T> array)
Alternate constructor.


ObjectArray

protected ObjectArray(int unused,
                      T[] values,
                      Array.IndexingOrder order,
                      int[] dims)
Internal constructor with a distinctive signature.


ObjectArray

protected ObjectArray(Class<T> clazz,
                      Array.IndexingOrder order,
                      int[] dims,
                      int[] strides)
Internal constructor for package use only.

Method Detail

wrap

protected ObjectArray<T> wrap(Array.IndexingOrder order,
                              int[] dims,
                              int[] strides)
Description copied from class: ProtoArray
Allocates a new array.

Specified by:
wrap in class ProtoArray<ObjectArray<T>,T[],T>
Parameters:
order - the storage order.
dims - the dimensions.
strides - the strides.
Returns:
the new array.

wrap

protected ObjectArray<T> wrap(T value,
                              Array.IndexingOrder order,
                              int[] dims,
                              int[] strides)
Description copied from class: ProtoArray
Allocates a new array initialized to the given value.

Specified by:
wrap in class ProtoArray<ObjectArray<T>,T[],T>
Parameters:
value - the initial value.
order - the storage order.
dims - the dimensions.
strides - the strides.
Returns:
the new array.

getComponentType

public Class<T> getComponentType()
Description copied from interface: Array
Gets the component type.


get

public T get(int... s)
Gets the value at the given logical index.


set

public void set(T value,
                int... s)
Sets the value at the given logical index.


values

public T[] values()
Description copied from class: ProtoArray
Gets the backing values.

Overrides:
values in class ProtoArray<ObjectArray<T>,T[],T>

getBytes

public byte[] getBytes()
Description copied from class: ProtoArray
Converts this array into bytes.

Overrides:
getBytes in class ProtoArray<ObjectArray<T>,T[],T>
Returns:
the bytes.

toString

public String toString()
Description copied from interface: Array
Creates a human-readable representation of this array.

Specified by:
toString in interface Array<ObjectArray<T>,T>
Overrides:
toString in class Object

iSort

public IntegerArray iSort(int dim)
Sorts along the given dimension.