ucar.ma2
Class ArrayBoolean

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

public class ArrayBoolean
extends Array

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

Author:
caron
See Also:
Array

Nested Class Summary
static class ArrayBoolean.D0
          Concrete implementation of Array specialized for byte, rank 0.
static class ArrayBoolean.D1
          Concrete implementation of Array specialized for boolean, rank 1.
static class ArrayBoolean.D2
          Concrete implementation of Array specialized for boolean, rank 2.
static class ArrayBoolean.D3
          Concrete implementation of Array specialized for boolean, rank 3.
static class ArrayBoolean.D4
          Concrete implementation of Array specialized for boolean, rank 4.
static class ArrayBoolean.D5
          Concrete implementation of Array specialized for boolean, rank 5.
static class ArrayBoolean.D6
          Concrete implementation of Array specialized for boolean, rank 6.
static class ArrayBoolean.D7
          Concrete implementation of Array specialized for boolean, rank 7.
 
Field Summary
protected  boolean[] storage
           
 
Fields inherited from class ucar.ma2.Array
indexCalc, rank, unsigned
 
Constructor Summary
ArrayBoolean(int[] dimensions)
          Create a new Array of type boolean and the given shape.
 
Method Summary
 boolean get(Index i)
          get the value at the specified index.
 boolean getBoolean(Index i)
          Get the array element at the current element of ima, as a boolean.
 boolean getBoolean(int index)
           
 byte getByte(Index i)
          not legal, throw ForbiddenConversionException
 byte getByte(int index)
           
 char getChar(Index i)
          not legal, throw ForbiddenConversionException
 char getChar(int index)
           
 double getDouble(Index i)
          not legal, throw ForbiddenConversionException
 double getDouble(int index)
           
 Class getElementType()
          Return the element class type
 float getFloat(Index i)
          not legal, throw ForbiddenConversionException
 float getFloat(int index)
           
 int getInt(Index i)
          not legal, throw ForbiddenConversionException
 int getInt(int index)
           
 long getLong(Index i)
          not legal, throw ForbiddenConversionException
 long getLong(int index)
           
 Object getObject(Index i)
          Get the array element at index as an Object.
 Object getObject(int index)
           
 short getShort(Index i)
          not legal, throw ForbiddenConversionException
 short getShort(int index)
           
 Object getStorage()
          Get underlying primitive array storage.
 void set(Index i, boolean value)
          set the value at the sepcified index.
 void setBoolean(Index i, boolean value)
          Set the array element at the current element of ima.
 void setBoolean(int index, boolean value)
           
 void setByte(Index i, byte value)
          not legal, throw ForbiddenConversionException
 void setByte(int index, byte value)
           
 void setChar(Index i, char value)
          not legal, throw ForbiddenConversionException
 void setChar(int index, char value)
           
 void setDouble(Index i, double value)
          not legal, throw ForbiddenConversionException
 void setDouble(int index, double value)
           
 void setFloat(Index i, float value)
          not legal, throw ForbiddenConversionException
 void setFloat(int index, float value)
           
 void setInt(Index i, int value)
          not legal, throw ForbiddenConversionException
 void setInt(int index, int value)
           
 void setLong(Index i, long value)
          not legal, throw ForbiddenConversionException
 void setLong(int index, long value)
           
 void setObject(Index i, Object value)
          Set the array element at index to the specified value.
 void setObject(int index, Object value)
           
 void setShort(Index i, short value)
          not legal, throw ForbiddenConversionException
 void setShort(int index, short value)
           
 
Methods inherited from class ucar.ma2.Array
arraycopy, copy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factory, factory, factoryConstant, flip, get1DJavaArray, getDataAsByteBuffer, getIndex, getIndexIterator, getIndexIteratorFast, getIndexPrivate, getRangeIterator, getRank, getShape, getSize, getSizeBytes, hasNext, isConstant, isUnsigned, makeArray, makeArray, makeArray, next, nextBoolean, nextByte, nextChar, nextDouble, nextFloat, nextInt, nextLong, nextShort, permute, reduce, reduce, resetLocalIterator, reshape, reshapeNoCopy, section, section, section, sectionNoReduce, sectionNoReduce, setUnsigned, shapeToString, slice, toString, transpose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

storage

protected boolean[] storage
Constructor Detail

ArrayBoolean

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

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

getStorage

public 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
Returns:
underlying primitive array storage

getElementType

public Class getElementType()
Return the element class type

Specified by:
getElementType in class Array
Returns:
the class of the element

get

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


set

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


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

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

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 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,
                      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.

getDouble

public double getDouble(int index)
Specified by:
getDouble in class Array

setDouble

public void setDouble(int index,
                      double value)
Specified by:
setDouble in class Array

getFloat

public float getFloat(int index)
Specified by:
getFloat in class Array

setFloat

public void setFloat(int index,
                     float value)
Specified by:
setFloat in class Array

getLong

public long getLong(int index)
Specified by:
getLong in class Array

setLong

public void setLong(int index,
                    long value)
Specified by:
setLong in class Array

getInt

public int getInt(int index)
Specified by:
getInt in class Array

setInt

public void setInt(int index,
                   int value)
Specified by:
setInt in class Array

getShort

public short getShort(int index)
Specified by:
getShort in class Array

setShort

public void setShort(int index,
                     short value)
Specified by:
setShort in class Array

getByte

public byte getByte(int index)
Specified by:
getByte in class Array

setByte

public void setByte(int index,
                    byte value)
Specified by:
setByte in class Array

getChar

public char getChar(int index)
Specified by:
getChar in class Array

setChar

public void setChar(int index,
                    char value)
Specified by:
setChar in class Array

getBoolean

public boolean getBoolean(int index)
Specified by:
getBoolean in class Array

setBoolean

public void setBoolean(int index,
                       boolean value)
Specified by:
setBoolean in class Array

getObject

public Object getObject(int index)
Specified by:
getObject in class Array

setObject

public void setObject(int index,
                      Object value)
Specified by:
setObject in class Array


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.