|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.phoenix_int.aserver.types.PHXSimpleType
com.phoenix_int.aserver.types.PHXSimpleArray
public abstract class PHXSimpleArray
This class enables components to create resizeable arrays where the number of dimensions is variable as well as the size of each dimension.
Typically you don't use this class directly but one of its sub-classes that are created and passed to you automatically.
| Field Summary | |
|---|---|
protected java.lang.Object |
_data
|
protected boolean |
_lockDims
|
protected boolean |
_lockResize
|
| Constructor Summary | |
|---|---|
protected |
PHXSimpleArray(java.lang.Object data)
Constructs a PHXSimpleArray that wraps a particular Analysis Server style variable. |
| Method Summary | |
|---|---|
protected void |
_getMetaData()
Gets the meta data off of the first element of the array and sets it into our meta data info. |
protected void |
_getMetaData(PHXSimpleType v)
Worker which takes the meta data from an instance of PHXSimpleType and sets it into our meta data. |
protected void |
_setMetaData()
Call this function to set the meta data from this object into every element of the array. |
protected void |
_setMetaData(PHXSimpleType v)
Sets a simple type's meta data based on the meta data in this object. |
protected java.lang.Object |
allocateElement(java.lang.Class elementClass)
Allocates a single element in a default state. |
static boolean |
checkRectangular(java.lang.Object obj)
Check if the array is rectangular |
protected abstract boolean |
dataTypeOK(java.lang.Class c)
Must override this function and return true if the specified class is acceptable as an array element component type. |
protected abstract java.lang.Object |
elementFromString(java.lang.String value)
Sub-classes must provide an implementation of this function which converts a string form of a single element to Object form. |
void |
fromString(int[] index,
PHXStringBuffer value)
Sets the value of a single element based on string input. |
void |
fromString(int[] index,
java.lang.String value)
Sets the value of a single element based on string input. |
void |
fromString(int index,
java.lang.String value)
Sets the value of a single element based on string input for 1-d arrays. |
void |
fromString(java.lang.String in)
reads in the entire array in string form. |
void |
fromString2(PHXStringBuffer in)
reads in the entire array in string form. |
static PHXSimpleArray |
generateFor(java.lang.Object o)
Static method to generate a new instance of one of the sub-classes of PHXSimpleArray as appropriate for the type of variable passed in. |
static PHXSimpleArray |
generateFor(java.lang.Object o,
java.lang.Class c)
Static method to generate a new instance of one of the sub-classes of PHXSimpleArray as appropriate for the type of variable passed in. |
java.lang.Object |
getArray()
Gets the entire contents of the array |
java.lang.Object |
getArrayElement(int index)
Gets a particular element from a 1-d array |
java.lang.Object |
getArrayElement(int[] index)
Gets a particular element from the array |
java.lang.Class |
getComponentType()
Returns the component type of the array wrapped with this class |
static java.lang.Class |
getComponentType(java.lang.Object v)
Gets the component type of an array, even for n-d arrays. |
int[] |
getDimensions()
|
static int[] |
getDimensions(java.lang.Object array)
Gets the array of dimensions of the array |
java.lang.Object |
getFirst()
Returns the first element of the array, or throws ArrayIndexOutOfBounds if there are no elements. |
int |
getLength()
Gets the length of the first dimension of the array |
int |
getLength(int dim)
Gets the length of a dimension of the array |
boolean |
getLockResize()
|
protected int[] |
getnDIndex(long oneDIndex,
int[] actualSize)
|
int |
getNumDimensions()
Gets the number of dimensions of the array |
static int |
getNumDimensions(java.lang.Object o)
|
PHXSimpleArray |
getSelf()
|
static boolean |
incrementIndex(int[] index,
int[] size)
Utility function for incrementing an nD index on the array |
void |
lockDimensions()
Tells this array that the number of dimensions cannot be changed from what they are right now. |
int[] |
newIndex()
Produces a new index based zeroed out, but with the proper dimensions |
static int[] |
parseIndex(java.lang.String index)
Takes a string of the form "anything[n, n2, n3]" or "n, n2, n3" and returns an int[] of the index values. |
void |
resize(int[] newSize)
Resize the nD array to the new size specified. |
void |
setArray(java.lang.Object v)
Sets the entire array. |
void |
setArrayElement(int[] index,
java.lang.Object v)
Sets a particular element of the array |
void |
setArrayElement(int index,
java.lang.Object v)
Sets a particular element of a 1-d array |
void |
setDimensions(int[] dim)
Sets the dimensions of the array. |
void |
setFirst(java.lang.Object val)
Sets the first element of the array, or throws ArrayIndexOutOfBounds if there are no elements. |
void |
setLength(int len)
Sets the length of the first dimension of the array. |
void |
setLength(int len,
int dim)
Sets the length of a dimensions of the array. |
void |
setLockResize(boolean lockResize)
Tells this array that it cannot be resized. |
java.lang.String |
toString()
Returns the string form of this array. |
java.lang.String |
toString(int index)
Converts a single element of a 1-d array to a string |
java.lang.String |
toString(int[] index)
Converts a single element to a string |
java.lang.String |
toString(java.lang.String index)
Converts a single element to a string |
PHXStringBuffer |
toString2()
Returns the string form of this array. |
PHXStringBuffer |
toString2(int[] index)
Converts a single element to a string |
PHXStringBuffer |
toString2(java.lang.String index)
Converts a single element to a string |
boolean |
validElement(int[] index,
int[] size)
Is the given index valid? |
| Methods inherited from class com.phoenix_int.aserver.types.PHXSimpleType |
|---|
addPropertyChangeListener, getDescription, getEnumTokens, getHasChanged, getUnits, removePropertyChangeListener, setDescription, setHasChanged, setUnits |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Object _data
protected boolean _lockDims
protected boolean _lockResize
| Constructor Detail |
|---|
protected PHXSimpleArray(java.lang.Object data)
v - The Analysis Server variable to wrap, which must
be an array.| Method Detail |
|---|
public void lockDimensions()
public void setLockResize(boolean lockResize)
public boolean getLockResize()
protected void _getMetaData()
protected void _getMetaData(PHXSimpleType v)
protected abstract boolean dataTypeOK(java.lang.Class c)
public void resize(int[] newSize)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
newSize - the new dimensions for the array
java.lang.IllegalAccessException
java.lang.InstantiationExceptionpublic java.lang.Object getFirst()
public void setFirst(java.lang.Object val)
public int getLength()
public int getLength(int dim)
dim - the dimension of interest
public void setLength(int len)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
len - the new length of the 1D array
java.lang.IllegalArgumentException - thrown if arguments are incorrect or don't
jive with the current array
java.lang.IllegalAccessException
java.lang.InstantiationException
public void setLength(int len,
int dim)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
len - the new length of the dimension.dim - the dimension to change
java.lang.IllegalArgumentException - thrown if arguments are incorrect or don't
jive with the current array
java.lang.IllegalAccessException
java.lang.InstantiationExceptionpublic static int[] getDimensions(java.lang.Object array)
public int[] getDimensions()
public void setDimensions(int[] dim)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
dim - the new dimensions for the array
java.lang.IllegalAccessException
java.lang.InstantiationExceptionpublic static int getNumDimensions(java.lang.Object o)
public int getNumDimensions()
public void fromString(int index,
java.lang.String value)
index - Which element to set.value - The new value.
public void fromString(int[] index,
PHXStringBuffer value)
index - Which element to set.value - The new value.
public void fromString(int[] index,
java.lang.String value)
index - Which element to set.value - The new value.protected abstract java.lang.Object elementFromString(java.lang.String value)
public java.lang.String toString(int index)
index - the index of the desired element
public static int[] parseIndex(java.lang.String index)
public java.lang.String toString(java.lang.String index)
index - the index of the desired element
public PHXStringBuffer toString2(java.lang.String index)
throws java.io.IOException
index - the index of the desired element
java.io.IOExceptionpublic java.lang.String toString(int[] index)
index - the index of the desired element
public PHXStringBuffer toString2(int[] index)
throws java.io.IOException
index - the index of the desired element
java.io.IOExceptionpublic java.lang.Object getArrayElement(int index)
index - the 1D array index into the 1D array
java.lang.IllegalArgumentException - thrown if 1D reference is given to a >1D arraypublic java.lang.Object getArrayElement(int[] index)
index - the 1D array index into the 1D array
java.lang.IllegalArgumentException - thrown if 1D reference is given to a >1D array
public void setArrayElement(int index,
java.lang.Object v)
index - Which index to setv - The new value. Note that this takes
an instance of a PHXType.
public void setArrayElement(int[] index,
java.lang.Object v)
index - Which index to setv - The new value. Note that this takes
an instance of a PHXType.public java.lang.Object getArray()
public void setArray(java.lang.Object v)
v - the new array (nD)
java.lang.IllegalArgumentException - thrown if array passed in is not rectangularpublic PHXSimpleArray getSelf()
public static boolean checkRectangular(java.lang.Object obj)
obj - the array to check
java.lang.NullPointerException - thrown if one of the values in the array is nullpublic static java.lang.Class getComponentType(java.lang.Object v)
v - The array to get the component type forpublic java.lang.Class getComponentType()
public static PHXSimpleArray generateFor(java.lang.Object o)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static PHXSimpleArray generateFor(java.lang.Object o,
java.lang.Class c)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void fromString(java.lang.String in)
bounds[3,2] { 1,2,3,4,5,6 }
fromString in interface IPHXTypein - the value of the variablepublic void fromString2(PHXStringBuffer in)
bounds[3,2] { 1,2,3,4,5,6 }
fromString2 in interface IPHXType2public java.lang.String toString()
toString in interface IPHXTypetoString in class java.lang.Objectpublic PHXStringBuffer toString2()
toString2 in interface IPHXType2
public static boolean incrementIndex(int[] index,
int[] size)
index - the index to incrementsize - the maximum size of the array
java.lang.IllegalArgumentException - thrown if index lengths don't matchpublic int[] newIndex()
public boolean validElement(int[] index,
int[] size)
index - the index to checksize - the maximum size
protected java.lang.Object allocateElement(java.lang.Class elementClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.InstantiationExceptionprotected void _setMetaData(PHXSimpleType v)
protected void _setMetaData()
protected int[] getnDIndex(long oneDIndex,
int[] actualSize)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||