ucar.ma2
Class ArrayObject

java.lang.Object
  extended by ucar.ma2.Array
      extended by ucar.ma2.ArrayObject
Direct Known Subclasses:
ArrayObject.D0, ArrayObject.D1, ArrayObject.D2, ArrayObject.D3, ArrayObject.D4, ArrayObject.D5, ArrayObject.D6, ArrayObject.D7

public class ArrayObject
extends Array

Concrete implementation of Array specialized for Objects. Data storage is with 1D java array of Objects.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
caron
See Also:
Array

Nested Class Summary
static class ArrayObject.D0
          Concrete implementation of Array specialized for Objects, rank 0.
static class ArrayObject.D1
          Concrete implementation of Array specialized for Objects, rank 1.
static class ArrayObject.D2
          Concrete implementation of Array specialized for Objects, rank 2.
static class ArrayObject.D3
          Concrete implementation of Array specialized for Objects, rank 3.
static class ArrayObject.D4
          Concrete implementation of Array specialized for Objects, rank 4.
static class ArrayObject.D5
          Concrete implementation of Array specialized for Objects, rank 5.
static class ArrayObject.D6
          Concrete implementation of Array specialized for Objects, rank 6.
static class ArrayObject.D7
          Concrete implementation of Array specialized for Objects, rank 7.
 
Field Summary
 
Fields inherited from class ucar.ma2.Array
scalarIndex
 
Constructor Summary
ArrayObject(java.lang.Class elementType, int[] shape)
          Create a new Array of type Object and the given shape.
 
Method Summary
 boolean getBoolean(Index i)
          not legal, throw ForbiddenConversionException
 byte getByte(Index i)
          not legal, throw ForbiddenConversionException
 char getChar(Index i)
          not legal, throw ForbiddenConversionException
 double getDouble(Index i)
          not legal, throw ForbiddenConversionException
 java.lang.Class getElementType()
          Return the element class type
 float getFloat(Index i)
          not legal, throw ForbiddenConversionException
 int getInt(Index i)
          not legal, throw ForbiddenConversionException
 long getLong(Index i)
          not legal, throw ForbiddenConversionException
 java.lang.Object getObject(Index i)
          Get the array element at index as an Object.
 short getShort(Index i)
          not legal, throw ForbiddenConversionException
 java.lang.Object getStorage()
          Get underlying primitive array storage.
 void setBoolean(Index i, boolean value)
          not legal, throw ForbiddenConversionException
 void setByte(Index i, byte value)
          not legal, throw ForbiddenConversionException
 void setChar(Index i, char value)
          not legal, throw ForbiddenConversionException
 void setDouble(Index i, double value)
          not legal, throw ForbiddenConversionException
 void setFloat(Index i, float value)
          not legal, throw ForbiddenConversionException
 void setInt(Index i, int value)
          not legal, throw ForbiddenConversionException
 void setLong(Index i, long value)
          not legal, throw ForbiddenConversionException
 void setObject(Index i, java.lang.Object value)
          Set the array element at index to the specified value.
 void setShort(Index i, short value)
          not legal, throw ForbiddenConversionException
 
Methods inherited from class ucar.ma2.Array
arraycopy, copy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factoryConstant, flip, get1DJavaArray, getIndex, getIndexIterator, getIndexIteratorFast, getIndexName, getRangeIterator, getRank, getShape, getSize, permute, reduce, reduce, reshape, section, section, section, sectionNoReduce, sectionNoReduce, setIndexName, shapeToString, slice, toString, transpose
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayObject

public ArrayObject(java.lang.Class elementType,
                   int[] shape)
Create a new Array of type Object and the given shape. dimensions.length determines the rank of the new Array.

Parameters:
elementType - the type of element, eg String
shape - the shape of the Array.
Method Detail

getStorage

public java.lang.Object getStorage()
Get underlying primitive array storage. CAUTION! You may invalidate your warrentee!

Specified by:
getStorage in class Array

getElementType

public java.lang.Class getElementType()
Return the element class type

Specified by:
getElementType in class Array

getDouble

public double getDouble(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getDouble in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to double if necessary.

setDouble

public void setDouble(Index i,
                      double value)
not legal, throw ForbiddenConversionException

Specified by:
setDouble in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getFloat

public float getFloat(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getFloat in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to float if necessary.

setFloat

public void setFloat(Index i,
                     float value)
not legal, throw ForbiddenConversionException

Specified by:
setFloat in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getLong

public long getLong(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getLong in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to long if necessary.

setLong

public void setLong(Index i,
                    long value)
not legal, throw ForbiddenConversionException

Specified by:
setLong in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getInt

public int getInt(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getInt in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to int if necessary.

setInt

public void setInt(Index i,
                   int value)
not legal, throw ForbiddenConversionException

Specified by:
setInt in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getShort

public short getShort(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getShort in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to short if necessary.

setShort

public void setShort(Index i,
                     short value)
not legal, throw ForbiddenConversionException

Specified by:
setShort in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getByte

public byte getByte(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getByte in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to float if necessary.

setByte

public void setByte(Index i,
                    byte value)
not legal, throw ForbiddenConversionException

Specified by:
setByte in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getBoolean

public boolean getBoolean(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getBoolean in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to boolean if necessary.

setBoolean

public void setBoolean(Index i,
                       boolean value)
not legal, throw ForbiddenConversionException

Specified by:
setBoolean in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getChar

public char getChar(Index i)
not legal, throw ForbiddenConversionException

Specified by:
getChar in class Array
Parameters:
i - Index with current element set
Returns:
value at index cast to char if necessary.

setChar

public void setChar(Index i,
                    char value)
not legal, throw ForbiddenConversionException

Specified by:
setChar in class Array
Parameters:
i - Index with current element set
value - the new value; cast to underlying data type if necessary.

getObject

public java.lang.Object getObject(Index i)
Description copied from class: Array
Get the array element at index as an Object. The returned value is wrapped in an object, eg Double for double

Specified by:
getObject in class Array
Parameters:
i - element Index
Returns:
Object value at index

setObject

public void setObject(Index i,
                      java.lang.Object value)
Description copied from class: Array
Set the array element at index to the specified value. the value must be passed wrapped in the appropriate Object (eg Double for double)

Specified by:
setObject in class Array
Parameters:
i - Index with current element set
value - the new value.