UniVista.support
Class ArrayWrapper

java.lang.Object
  |
  +--UniVista.support.ArrayWrapper
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ArrayWrapper
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class holds multi-dimensional arrays. The arrays are stored internally as Vectors, with the ability to get easy access for 1D, 2D, and 3D arrays. Higher dimensionality arrays will need to be implemented either as 1D arrays with offsets or manually through storing vectors in a 3D array.

See Also:
Serialized Form

Constructor Summary
ArrayWrapper(ArrayWrapper a)
           
ArrayWrapper(int d)
           
 
Method Summary
 java.lang.Object clone()
          clone the array
 void duplicate(ArrayWrapper obj)
          duplicate values
 boolean equals(java.lang.Object obj)
          Equals override.
 java.lang.Object get(int i)
          retrieve an object from a one dimensional array.
 java.lang.Object get(int i, int j)
          retrieve an object from a two dimensional array.
 java.lang.Object get(int i, int j, int k)
          retrieve an object from a 3 dimensional array
 int getDimension()
          retrieve the dimension of the array object
 int getFirstDimensionSize()
          get the first dimension size
 int getSecondDimensionSize()
          return the dimensionality of the second dimension
 int getSecondDimensionSize(int i)
          return the dimensionality of the second dimension of a given row
 int getThirdDimensionSize()
          return the dimensionality of the third dimension
 int getThirdDimensionSize(int i, int j)
          return the dimensionality of the third dimension of a given row/column
 java.lang.Class getTypeClass()
          Obtain a Class of the type of Object being wrapped.
 java.lang.String getUserData()
          get user data
 void resize(int d)
          Create a new array of the specified dimensionality.
 void set(int i, int j, int k, java.lang.Object obj)
          set an object in a three dimensional array
 void set(int i, int j, java.lang.Object obj)
          set an element of a two dimensional array
 void set(int i, java.lang.Object obj)
          add an object to a 1 dimensional array.
 void setDimension(int d)
          change the dimension of the array object.
 void setTypeClass(java.lang.Class c)
          Set the Class of the type of Object being wrapped.
 void setUserData(java.lang.String obj)
          set user data
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayWrapper

public ArrayWrapper(int d)

ArrayWrapper

public ArrayWrapper(ArrayWrapper a)
Method Detail

resize

public void resize(int d)
Create a new array of the specified dimensionality.

clone

public java.lang.Object clone()
clone the array
Overrides:
clone in class java.lang.Object

duplicate

public void duplicate(ArrayWrapper obj)
duplicate values

equals

public boolean equals(java.lang.Object obj)
Equals override. NOTE: For JDK1.1.X, the method equals of java.util.Vector doesn't work properly, so there is a temporary alternative check for equality.
Overrides:
equals in class java.lang.Object
See Also:
equals(java.util.Vector)

get

public java.lang.Object get(int i)
                     throws ArrayWrapperException
retrieve an object from a one dimensional array.
Throws:
ArrayWrapperException -  

get

public java.lang.Object get(int i,
                            int j)
                     throws ArrayWrapperException
retrieve an object from a two dimensional array.
Throws:
ArrayWrapperException -  

get

public java.lang.Object get(int i,
                            int j,
                            int k)
                     throws ArrayWrapperException
retrieve an object from a 3 dimensional array
Throws:
ArrayWrapperException -  

getDimension

public int getDimension()
retrieve the dimension of the array object

getFirstDimensionSize

public int getFirstDimensionSize()
get the first dimension size

getSecondDimensionSize

public int getSecondDimensionSize()
                           throws ArrayWrapperException
return the dimensionality of the second dimension
Throws:
ArrayWrapperException -  

getSecondDimensionSize

public int getSecondDimensionSize(int i)
                           throws ArrayWrapperException
return the dimensionality of the second dimension of a given row
Throws:
ArrayWrapperException -  

getThirdDimensionSize

public int getThirdDimensionSize()
                          throws ArrayWrapperException
return the dimensionality of the third dimension
Throws:
ArrayWrapperException -  

getThirdDimensionSize

public int getThirdDimensionSize(int i,
                                 int j)
                          throws ArrayWrapperException
return the dimensionality of the third dimension of a given row/column
Throws:
UniVista.support. -  

getUserData

public java.lang.String getUserData()
get user data

set

public void set(int i,
                int j,
                int k,
                java.lang.Object obj)
         throws ArrayWrapperException
set an object in a three dimensional array
Throws:
ArrayWrapperException -  

set

public void set(int i,
                int j,
                java.lang.Object obj)
         throws ArrayWrapperException
set an element of a two dimensional array
Throws:
ArrayWrapperException -  

set

public void set(int i,
                java.lang.Object obj)
         throws ArrayWrapperException
add an object to a 1 dimensional array.
Throws:
ArrayWrapperException -  

setDimension

public void setDimension(int d)
change the dimension of the array object. Note that changing the dimension of the array clears the data.

setUserData

public void setUserData(java.lang.String obj)
set user data

setTypeClass

public void setTypeClass(java.lang.Class c)
Set the Class of the type of Object being wrapped.

getTypeClass

public java.lang.Class getTypeClass()
Obtain a Class of the type of Object being wrapped.