ucar.ma2
Class ArrayInt

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

public class ArrayInt
extends Array

Concrete implementation of Array specialized for longs. Data storage is with 1D java array of longs. issues: what should we do if a conversion loses accuracy? nothing ? Exception ?

Version:
$Revision: 1.5 $ $Date: 2005/05/11 00:09:53 $
Author:
caron
See Also:
Array

Nested Class Summary
static class ArrayInt.D0
          Concrete implementation of Array specialized for ints, rank 0.
static class ArrayInt.D1
          Concrete implementation of Array specialized for ints, rank 1.
static class ArrayInt.D2
          Concrete implementation of Array specialized for ints, rank 2.
static class ArrayInt.D3
          Concrete implementation of Array specialized for ints, rank 3.
static class ArrayInt.D4
          Concrete implementation of Array specialized for ints, rank 4.
static class ArrayInt.D5
          Concrete implementation of Array specialized for ints, rank 5.
static class ArrayInt.D6
          Concrete implementation of Array specialized for ints, rank 6.
static class ArrayInt.D7
          Concrete implementation of Array specialized for ints, rank 7.
 
Field Summary
 
Fields inherited from class ucar.ma2.Array
scalarIndex
 
Constructor Summary
ArrayInt(int[] dimensions)
          Create a new Array of type int and the given shape.
 
Method Summary
 int get(Index i)
          get the value at the specified index.
 boolean getBoolean(Index i)
          not legal, throw ForbiddenConversionException
 byte getByte(Index i)
          Get the array element at the current element of ima, as a byte.
 char getChar(Index i)
          Get the array element at the current element of ima, as a char.
 double getDouble(Index i)
          Get the array element at the current element of ima, as a double.
 java.lang.Class getElementType()
          Return the element class type
 float getFloat(Index i)
          Get the array element at the current element of ima, as a float.
 int getInt(Index i)
          Get the array element at the current element of ima, as a int.
 long getLong(Index i)
          Get the array element at the current element of ima, as a long.
 java.lang.Object getObject(Index i)
          Get the array element at index as an Object.
 short getShort(Index i)
          Get the array element at the current element of ima, as a short.
 java.lang.Object getStorage()
          Get underlying primitive array storage.
 void set(Index i, int value)
          set the value at the sepcified index.
 void setBoolean(Index i, boolean value)
          not legal, throw ForbiddenConversionException
 void setByte(Index i, byte value)
          Set the array element at the current element of ima.
 void setChar(Index i, char value)
          Set the array element at the current element of ima.
 void setDouble(Index i, double value)
          Set the array element at the current element of ima.
 void setFloat(Index i, float value)
          Set the array element at the current element of ima.
 void setInt(Index i, int value)
          Set the array element at the current element of ima.
 void setLong(Index i, long value)
          Set the array element at the current element of ima.
 void setObject(Index i, java.lang.Object value)
          Set the array element at index to the specified value.
 void setShort(Index i, short value)
          Set the array element at the current element of ima.
 
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

ArrayInt

public ArrayInt(int[] dimensions)
Create a new Array of type int and the given shape. dimensions.length determines the rank of the new Array.

Parameters:
dimensions - the shape of the Array.
Method Detail

getStorage

public java.lang.Object getStorage()
Description copied from class: Array
Get underlying primitive array storage. Exposed for efficiency, use at your own risk.

Specified by:
getStorage in class Array

getElementType

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

Specified by:
getElementType in class Array

get

public int get(Index i)
get the value at the specified index.


set

public void set(Index i,
                int value)
set the value at the sepcified index.


getDouble

public double getDouble(Index i)
Description copied from class: Array
Get the array element at the current element of ima, as a double.

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)
Description copied from class: Array
Set the array element at the current element of ima.

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)
Description copied from class: Array
Get the array element at the current element of ima, as a float.

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)
Description copied from class: Array
Set the array element at the current element of ima.

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)
Description copied from class: Array
Get the array element at the current element of ima, as a long.

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)
Description copied from class: Array
Set the array element at the current element of ima.

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)
Description copied from class: Array
Get the array element at the current element of ima, as a int.

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)
Description copied from class: Array
Set the array element at the current element of ima.

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)
Description copied from class: Array
Get the array element at the current element of ima, as a short.

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)
Description copied from class: Array
Set the array element at the current element of ima.

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)
Description copied from class: Array
Get the array element at the current element of ima, as a byte.

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)
Description copied from class: Array
Set the array element at the current element of ima.

Specified by:
setByte 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)
Description copied from class: Array
Get the array element at the current element of ima, as a char.

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)
Description copied from class: Array
Set the array element at the current element of ima.

Specified by:
setChar 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.

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.