gov.llnl.sidl
Class BaseArray

java.lang.Object
  extended bygov.llnl.sidl.BaseArray
Direct Known Subclasses:
Boolean.Array, Character.Array, Double.Array, DoubleComplex.Array, Float.Array, FloatComplex.Array, Integer.Array, Long.Array, Opaque.Array, String.Array

public abstract class BaseArray
extends java.lang.Object

Class BaseArray is the base array for all sidl Java arrays in the run-time system. This class provides basic support for bounds checking and management of the IOR array pointer object.


Field Summary
protected  long d_array
           
protected  boolean d_owner
           
 
Constructor Summary
protected BaseArray()
          Construct an empty array object.
protected BaseArray(long array, boolean owner)
          Create an array using an IOR array pointer.
 
Method Summary
abstract  void _addRef()
          Abstract method adds 1 to array's reference count.
abstract  void _deallocate()
          Deallocate deletes java's reference to the array (calls deleteRef) But does not (nessecarily) case the array to be GCed.
protected abstract  void _destroy()
          Abstract method to destroy the array.
abstract  int _dim()
          Abstract method to get the dimension of the array.
abstract  boolean _isColumnOrder()
          Abstract method returns true if array is ColumnOrder.
abstract  boolean _isRowOrder()
          Abstract method returns true if array if RowOrder.
abstract  int _lower(int dim)
          Abstract method to fetch the specified lower bound of the array.
protected abstract  void _reallocate(int dim, int[] lower, int[] upper, boolean isRow)
          Abstract method to reallocate array data using the specified dimension, lower bounds, and upper bounds.
abstract  int _stride(int dim)
          Abstract method to fetch the stride of the specified dimen of the array.
abstract  int _upper(int dim)
          Abstract method to fetch the specified upper bound of the array.
protected  void checkBounds(int i)
          Check that the index is valid for the array.
protected  void checkBounds(int i, int j)
          Check that the indices are valid for the array.
protected  void checkBounds(int i, int j, int k)
          Check that the indices are valid for the array.
protected  void checkBounds(int i, int j, int k, int l)
          Check that the indices are valid for the array.
protected  void checkBounds(int i, int j, int k, int l, int m)
          Check that the indices are valid for the array.
protected  void checkBounds(int i, int j, int k, int l, int m, int n)
          Check that the indices are valid for the array.
protected  void checkBounds(int i, int j, int k, int l, int m, int n, int o)
          Check that the indices are valid for the array.
protected  void checkDimension(int d)
          Check that the array is equal to the specified rank.
protected  void checkIndexBounds(int i, int d)
          Check that the index is valid for the specified dimension.
protected  void checkNullArray()
          Throw a NullPointerException if the array is null.
 void destroy()
          Destroy the existing array and make it null.
 int dim()
          Return the dimension of the array.
protected  void finalize()
          The finalizer of this object deallocates the IOR array reference if we are the owner and the referece is not null.
 long get_ior_pointer()
          Return the pointer to the implementation of the Array (A special function for Object arrays, No touchie!
 boolean get_owner()
          Return the array owner flag (A special function for Object arrays, No touchie!
 boolean isNull()
          Check whether the array referenced by this object is null.
 int lower(int dim)
          Return the lower index of the array corresponding to the specified array dimension.
 void reallocate(int dim, int[] lower, int[] upper, boolean isRow)
          Reallocate array data using the specified dimension and lower and upper bounds.
protected  void reset(long array, boolean owner)
          Destroy existing array data (if present and owner) and assign the new array pointer and owner.
 void set_ior_pointer(long p)
          Set the pointer to the implementation of the Array (A special function for Object arrays, No touchie!
 void set_owner(boolean p)
          Return the array owner flag (A special function for Object arrays, No touchie!
 int stride(int dim)
          Return the stride of the array corresponding to the specified array dimension.
 int upper(int dim)
          Return the upper index of the array corresponding to the specified array dimension.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_array

protected long d_array

d_owner

protected boolean d_owner
Constructor Detail

BaseArray

protected BaseArray()
Construct an empty array object. This object must be allocated before any actions are performed on the array data.


BaseArray

protected BaseArray(long array,
                    boolean owner)
Create an array using an IOR array pointer. The pointer value may be zero (representing null). If the owner flag is true, then the array will be deallocated when this object disappears.

Method Detail

reset

protected void reset(long array,
                     boolean owner)
Destroy existing array data (if present and owner) and assign the new array pointer and owner.


isNull

public boolean isNull()
Check whether the array referenced by this object is null.


_dim

public abstract int _dim()
Abstract method to get the dimension of the array. This method will be implemented in subclasses as a native method.


_lower

public abstract int _lower(int dim)
Abstract method to fetch the specified lower bound of the array. This method will be implemented in subclasses as a native method. The specified array dimension must be between zero and the array dimension minus one. Invalid values will have unpredictable (but almost certainly bad) results.


_upper

public abstract int _upper(int dim)
Abstract method to fetch the specified upper bound of the array. This method will be implemented in subclasses as a native method. The specified array dimension must be between zero and the array dimension minus one. Invalid values will have unpredictable (but almost certainly bad) results.


_stride

public abstract int _stride(int dim)
Abstract method to fetch the stride of the specified dimen of the array. This method will be implemented in subclasses as a native method. The specified array dimension must be between zero and the array dimension minus one. Invalid values will have unpredictable (but almost certainly bad) results.


_isColumnOrder

public abstract boolean _isColumnOrder()
Abstract method returns true if array is ColumnOrder. This method will be implemented in subclasses as a native method.


_isRowOrder

public abstract boolean _isRowOrder()
Abstract method returns true if array if RowOrder. This method will be implemented in subclasses as a native method.


_addRef

public abstract void _addRef()
Abstract method adds 1 to array's reference count. Not for users but for internal babel stuff.


_deallocate

public abstract void _deallocate()
Deallocate deletes java's reference to the array (calls deleteRef) But does not (nessecarily) case the array to be GCed.


_destroy

protected abstract void _destroy()
Abstract method to destroy the array. This will be called by the object finalizer if the array is owned by this object.


_reallocate

protected abstract void _reallocate(int dim,
                                    int[] lower,
                                    int[] upper,
                                    boolean isRow)
Abstract method to reallocate array data using the specified dimension, lower bounds, and upper bounds. This routine assumes that the dimension and indices are valid.


destroy

public void destroy()
Destroy the existing array and make it null. This method deallocates the IOR array reference if we are the owner and the reference is not null. The new array reference is null.


get_ior_pointer

public long get_ior_pointer()
Return the pointer to the implementation of the Array (A special function for Object arrays, No touchie!


set_ior_pointer

public void set_ior_pointer(long p)
Set the pointer to the implementation of the Array (A special function for Object arrays, No touchie!


get_owner

public boolean get_owner()
Return the array owner flag (A special function for Object arrays, No touchie!


set_owner

public void set_owner(boolean p)
Return the array owner flag (A special function for Object arrays, No touchie!


finalize

protected void finalize()
                 throws java.lang.Throwable
The finalizer of this object deallocates the IOR array reference if we are the owner and the referece is not null.

Throws:
java.lang.Throwable

reallocate

public void reallocate(int dim,
                       int[] lower,
                       int[] upper,
                       boolean isRow)
Reallocate array data using the specified dimension and lower and upper bounds. Old array data is deleted. Each of the lower and upper bounds arrays must contain dim elements. Upper array bounds are inclusive. An array index out of bounds exception is thrown if any of the indices are invalid.


dim

public int dim()
Return the dimension of the array. If the array is null, then the dimension is zero.


checkNullArray

protected void checkNullArray()
Throw a NullPointerException if the array is null.


checkDimension

protected void checkDimension(int d)
Check that the array is equal to the specified rank. If the array ranks do not match, an ArrayIndexOutOfBoundsException is thrown. This routine assumes that the array is not null.


checkIndexBounds

protected void checkIndexBounds(int i,
                                int d)
Check that the index is valid for the specified dimension. An ArrayIndexOutOfBoundsException is thrown if the index is out of bounds. This routine assumes both that the array pointer is not null and that the dimension argument is valid.


checkBounds

protected void checkBounds(int i)
Check that the index is valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j,
                           int k)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j,
                           int k,
                           int l)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j,
                           int k,
                           int l,
                           int m)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j,
                           int k,
                           int l,
                           int m,
                           int n)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


checkBounds

protected void checkBounds(int i,
                           int j,
                           int k,
                           int l,
                           int m,
                           int n,
                           int o)
Check that the indices are valid for the array. A null pointer exception is thrown if the arry is null. An array index out of bounds exception is thrown if the index is out of bounds.


lower

public int lower(int dim)
Return the lower index of the array corresponding to the specified array dimension. This routine will throw a null pointer exception if the object is null or an array index out of bounds exception if the specified array dimension is not valid.


upper

public int upper(int dim)
Return the upper index of the array corresponding to the specified array dimension. The array runs from the lower bound to the upper bound, inclusive. This routine will throw a null pointer exception if the object is null or an array index out of bounds exception if the specified array dimension is not valid.


stride

public int stride(int dim)
Return the stride of the array corresponding to the specified array dimension. This routine will throw a null pointer exception if the object is null or an array index out of bounds exception if the specified array dimension is not valid.