Package xal.tools
Class ArrayValue
java.lang.Object
java.lang.Number
xal.tools.ArrayValue
- All Implemented Interfaces:
Serializable
ArrayStore is the base class of a class cluster which manages the storage of
an array of primitive types and String. It includes factory methods to
instantiate storage of specific types.
- Author:
- tap
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Empty constructorprotected
ArrayValue
(Object anArray) Primary constructor to override -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayValue
arrayValueFromArray
(Object newArray) Create a new ArrayValue from an Object array.abstract byte[]
static ArrayValue
byteStore
(byte scalar) Factory method to instantiate a new ArrayValue store for the byte scalar typestatic ArrayValue
byteStore
(byte[] newArray) Factory method to instantiate a new ArrayValue store for the byte array typefinal byte
get the first element value as a byteabstract byte
byteValueAt
(int index) abstract double[]
static ArrayValue
doubleStore
(double scalar) Factory method to instantiate a new ArrayValue store for the double scalar typestatic ArrayValue
doubleStore
(double[] newArray) Factory method to instantiate a new ArrayValue store for the double array typefinal double
get the first element value as a doubleabstract double
doubleValueAt
(int index) abstract float[]
static ArrayValue
floatStore
(float scalar) Factory method to instantiate a new ArrayValue store for the float scalar typestatic ArrayValue
floatStore
(float[] newArray) Factory method to instantiate a new ArrayValue store for the float array typefinal float
get the first element value as a floatabstract float
floatValueAt
(int index) final int
getCount()
get the length of the arrayfinal Class<?>
getType()
get the native type of the arrayabstract int[]
intArray()
static ArrayValue
intStore
(int scalar) Factory method to instantiate a new ArrayValue store for the int scalar typestatic ArrayValue
intStore
(int[] newArray) Factory method to instantiate a new ArrayValue store for the int array typefinal int
intValue()
get the first element value as an intabstract int
intValueAt
(int index) abstract long[]
static ArrayValue
longStore
(long scalar) Factory method to instantiate a new ArrayValue store for the long scalar typestatic ArrayValue
longStore
(long[] newArray) Factory method to instantiate a new ArrayValue store for the long array typefinal long
get the first element value as a longabstract long
longValueAt
(int index) static ArrayValue
numberStore
(Number number) Factory method to instantiate a new ArrayValue store from a Number.abstract short[]
static ArrayValue
shortStore
(short scalar) Factory method to instantiate a new ArrayValue store for the short scalar typestatic ArrayValue
shortStore
(short[] newArray) Factory method to instantiate a new ArrayValue store for the short array typefinal short
get the first element value as a shortabstract short
shortValueAt
(int index) abstract String[]
static ArrayValue
stringStore
(String scalar) Factory method to instantiate a new ArrayValue store for the String scalar typestatic ArrayValue
stringStore
(String[] newArray) Factory method to instantiate a new ArrayValue store for the String array typefinal String
get the first element value as a Stringabstract String
stringValueAt
(int index) toString()
override toString() to return a string value
-
Field Details
-
array
the array of data
-
-
Constructor Details
-
ArrayValue
protected ArrayValue()Empty constructor -
ArrayValue
Primary constructor to override
-
-
Method Details
-
getCount
public final int getCount()get the length of the array -
getType
get the native type of the array -
toString
override toString() to return a string value -
byteValue
public final byte byteValue()get the first element value as a byte -
byteValueAt
public abstract byte byteValueAt(int index) -
byteArray
public abstract byte[] byteArray() -
shortValue
public final short shortValue()get the first element value as a short- Overrides:
shortValue
in classNumber
-
shortValueAt
public abstract short shortValueAt(int index) -
shortArray
public abstract short[] shortArray() -
intValue
public final int intValue()get the first element value as an int -
intValueAt
public abstract int intValueAt(int index) -
intArray
public abstract int[] intArray() -
longValue
public final long longValue()get the first element value as a long -
longValueAt
public abstract long longValueAt(int index) -
longArray
public abstract long[] longArray() -
floatValue
public final float floatValue()get the first element value as a float- Specified by:
floatValue
in classNumber
-
floatValueAt
public abstract float floatValueAt(int index) -
floatArray
public abstract float[] floatArray() -
doubleValue
public final double doubleValue()get the first element value as a double- Specified by:
doubleValue
in classNumber
-
doubleValueAt
public abstract double doubleValueAt(int index) -
doubleArray
public abstract double[] doubleArray() -
stringValue
get the first element value as a String -
stringValueAt
-
stringArray
-
byteStore
Factory method to instantiate a new ArrayValue store for the byte array type -
byteStore
Factory method to instantiate a new ArrayValue store for the byte scalar type -
shortStore
Factory method to instantiate a new ArrayValue store for the short array type -
shortStore
Factory method to instantiate a new ArrayValue store for the short scalar type -
intStore
Factory method to instantiate a new ArrayValue store for the int array type -
intStore
Factory method to instantiate a new ArrayValue store for the int scalar type -
longStore
Factory method to instantiate a new ArrayValue store for the long array type -
longStore
Factory method to instantiate a new ArrayValue store for the long scalar type -
floatStore
Factory method to instantiate a new ArrayValue store for the float array type -
floatStore
Factory method to instantiate a new ArrayValue store for the float scalar type -
doubleStore
Factory method to instantiate a new ArrayValue store for the double array type -
doubleStore
Factory method to instantiate a new ArrayValue store for the double scalar type -
numberStore
Factory method to instantiate a new ArrayValue store from a Number.- Parameters:
number
- The number to represent.- Returns:
- The ArrayValue representation
-
stringStore
Factory method to instantiate a new ArrayValue store for the String array type -
stringStore
Factory method to instantiate a new ArrayValue store for the String scalar type -
arrayValueFromArray
Create a new ArrayValue from an Object array. Inspect the array type to create the proper kind of storage.- Throws:
IllegalArgumentException
-