Class: PHXDoubleArray
Last update: 16.07.2025Package: com.phoenix_int.aserver.types
Class Hierarchy
↳ java.lang.Object
↳ [PHXSimpleType](PHXSimpleType.md)
↳ [PHXSimpleArray](PHXSimpleArray.md)[PHXDouble](PHXDouble.md)>
↳ PHXDoubleArray
Implemented Interfaces
- IPHXFormat, IPHXType, IPHXType2, IPHXUnits, java.lang.IterablePHXDouble>
Declaration
public class PHXDoubleArray
extends PHXSimpleArray<phxdouble>
implements IPHXFormat
Class wraps an array of PHXDouble variables for the ScriptWrapper utility.
Nested Class Summary
Nested classes/interfaces inherited from interface IPHXType2
IPHXType2.IVisitor<t>
Field Summary
Fields inherited from class PHXSimpleArray
_data, _lockDims, _lockResize
Constructor Summary
| Constructor and Description |
|---|
PHXDoubleArray() |
PHXDoubleArray(java.lang.Object data) |
PHXDoubleArray(PHXDoubleArray other)Clone another PHXDoubleArray's value and metadata. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
protected void |
_getMetaData([PHXSimpleType](PHXSimpleType.md) v2)Worker which takes the meta data from an instance of PHXSimpleType and sets it into our meta data. |
protected void |
_setMetaData([PHXSimpleType](PHXSimpleType.md) v2)Sets a simple type's meta data based on the meta data in this object. |
void |
_sort(PHXDoubleArray array, boolean ascend) |
<t> T |
Accept([IPHXType2](IPHXType2.md).IVisitor<t> visitor)Accept a Visitor. |
protected java.lang.Object |
allocateElement(java.lang.Class elementClass)Allocates a single element in a default state. |
PHXDoubleArray |
createCopy()Create a copy of this instance, including the value and metadata. |
protected 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 java.lang.Object |
elementFromString(java.lang.String val)Sub-classes must provide an implementation of this function which converts a string form of a single element to Object form. |
void |
fromObject(java.lang.Object toRead)Load the value of this object from the specified object. |
double |
getAvg() |
double |
getDoubleValue(int index)Gets an element as a double. |
double |
getDoubleValue(int[] index)Gets an element as a double. |
java.lang.String[] |
getEnumAliases()An interface function for the enumeration array. |
java.lang.String |
getEnumAliasesStr()An interface function for the enumeration array. |
double[] |
getEnumValues()An interface function for the enumeration array. |
java.lang.String |
getEnumValuesStr()Interface function to pass out the enumeration array as a comma separated string. |
java.lang.String |
getFormat()Get the format string for the variable. |
boolean |
getHasLowerBound()Retrieves the hasLowerBound flag. |
boolean |
getHasUpperBound()Retrieves the hasUpperBound flag. |
double |
getLowerBound()Retrieves the current lower bound value. |
double |
getMax() |
double |
getMin() |
double |
getUpperBound()Retrieves the current upper bound value. |
PHXDouble |
getValue(int[] index)Gets an element as a PHXDouble object. |
boolean |
hasFormat()Whether or not the variable has a format. |
void |
setEnumAliases(java.lang.String values)Takes a comma separated string of values and fills the enumeration aliases list with values. |
void |
setEnumAliases(java.lang.String[] values)Sets the enumeration aliases list. |
void |
setEnumValues(double[] values)Sets the enumeration list of valid values. |
void |
setEnumValues(java.lang.String values)Takes a comma separated string of values and fills the enumeration List with values. |
void |
setFormat(java.lang.String format)Set the format string for the variable. |
void |
setHasLowerBound(boolean value)Sets the hasLowerBound flag. |
void |
setHasUpperBound(boolean value)Sets the hasUpperBound flag. |
void |
setLowerBound(double value)Sets the lower bound. |
void |
setUpperBound(double value)Sets the upper bound. |
void |
setValue(int[] index, double val)Sets an element as a double. |
void |
setValue(int[] index, PHXDouble val)Sets an element as a PHXDouble object. |
void |
setValue(int index, double val)Sets an element as a double. |
void |
sort() |
void |
sortReverse() |
Methods inherited from class PHXSimpleArray
_getMetaData, _setMetaData, checkRectangular, copy, equalsNatural, fromString, fromString, fromString, fromString, fromString2, generateFor, generateFor, getArray, getArrayElement, getArrayElement, getComponentType, getComponentType, getDimensions, getDimensions, getFirst, getLength, getLength, getLockResize, getnDIndex, getNumDimensions, getNumDimensions, getSelf, getValue, incrementIndex, iterator, lockDimensions, newIndex, parseIndex, resize, setArray, setArrayElement, setArrayElement, setDimensions, setFirst, setLength, setLength, setLockResize, setValue, toString, toString, toString, toString, toString2, toString2, toString2, validElement
Methods inherited from class PHXSimpleType
_copyMetadataFromOther, 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
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Constructor Detail
PHXDoubleArray
public PHXDoubleArray()
PHXDoubleArray
public PHXDoubleArray(java.lang.Object data)
PHXDoubleArray
public PHXDoubleArray(PHXDoubleArray other)
Parameters:
other- the other PHXDoubleArray to clone.
Clone another PHXDoubleArray's value and metadata.
Method Detail
dataTypeOK
protected boolean dataTypeOK(java.lang.Class c)
Description copied from class: PHXSimpleArray
Must override this function and return true if the specified class is acceptable as an array element component type.
Specified by:
dataTypeOKin class PHXSimpleArray
allocateElement
protected java.lang.Object allocateElement(java.lang.Class elementClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
Description copied from class: PHXSimpleArray
Allocates a single element in a default state. If the class type in question has a default constructor, there is no need to override this.
Overrides:
allocateElementin class PHXSimpleArray
Throws:
java.lang.IllegalAccessExceptionjava.lang.InstantiationException
setUpperBound
public void setUpperBound(double value)
Parameters:
value- the upper bound
Sets the upper bound. The hasUpperBound value is set to true.
getUpperBound
public double getUpperBound()
Retrieves the current upper bound value.
Returns:
- the upper bound
Throws:
java.lang.IllegalStateException- Thrown if there is no upper bound defined.
setLowerBound
public void setLowerBound(double value)
Parameters:
value- the lower bound
Sets the lower bound. The hasLowerBound value is set to true.
getLowerBound
public double getLowerBound()
Retrieves the current lower bound value.
Returns:
- the lower bound
setHasUpperBound
public void setHasUpperBound(boolean value)
Parameters:
value- true or false
Sets the hasUpperBound flag.
getHasUpperBound
public boolean getHasUpperBound()
Retrieves the hasUpperBound flag.
Returns:
- true or false
setHasLowerBound
public void setHasLowerBound(boolean value)
Parameters:
value- true or false
Sets the hasLowerBound flag.
getHasLowerBound
public boolean getHasLowerBound()
Retrieves the hasLowerBound flag.
Returns:
- true or false
setEnumValues
public void setEnumValues(java.lang.String values)
Takes a comma separated string of values and fills the enumeration List with values.
Parameters:
values- A comma separated string of enumeration values
setEnumValues
public void setEnumValues(double[] values)
Sets the enumeration list of valid values.
Parameters:
values- An array of double values
getEnumValues
public double[] getEnumValues()
An interface function for the enumeration array.
Returns:
- an array of the possible values of the list
getEnumValuesStr
public java.lang.String getEnumValuesStr()
Interface function to pass out the enumeration array as a comma separated string.
Returns:
- comma separated string of the possible values of the list
setEnumAliases
public void setEnumAliases(java.lang.String values)
Takes a comma separated string of values and fills the enumeration aliases list with values.
Parameters:
values- A comma separated string of enumeration aliases
setEnumAliases
public void setEnumAliases(java.lang.String[] values)
Sets the enumeration aliases list.
Parameters:
values- An array of strings
getEnumAliases
public java.lang.String[] getEnumAliases()
An interface function for the enumeration array.
Returns:
- an array of the possible values of the list
getEnumAliasesStr
public java.lang.String getEnumAliasesStr()
An interface function for the enumeration array.
Returns:
- a comma separated string of the possible values of the list
setFormat
public void setFormat(java.lang.String format)
Set the format string for the variable.
Specified by:
setFormatin interface IPHXFormat
Parameters:
format- format string
getFormat
public java.lang.String getFormat()
Get the format string for the variable.
Specified by:
getFormatin interface IPHXFormat
Returns:
- format string
hasFormat
public boolean hasFormat()
Whether or not the variable has a format.
Specified by:
hasFormatin interface IPHXFormat
Returns:
- true if variable has a format
_setMetaData
protected void _setMetaData(PHXSimpleType v2)
Description copied from class: PHXSimpleArray
Sets a simple type's meta data based on the meta data in this object. Override this to set additional information in sub-classes. Be sure to call super._setMetaData(PHXSimpleType).
Overrides:
_setMetaDatain class PHXSimpleArray
_getMetaData
protected void _getMetaData([PHXSimpleType](PHXSimpleType.md) v2)
Description copied from class: PHXSimpleArray
Worker which takes the meta data from an instance of PHXSimpleType and sets it into our meta data. Override this in order to add more custom meta data in sub-classes. Be sure to call super._getMetaData(PHXSimpleType), though!
Overrides:
_getMetaDatain class PHXSimpleArray
getValue
public PHXDouble getValue(int[] index)
Gets an element as a PHXDouble object.
Specified by:
getValuein class PHXSimpleArray
Parameters:
index- nD array index
Returns:
- referenced array value
getDoubleValue
public double getDoubleValue(int index)
Gets an element as a double.
Parameters:
index- 1D array index
Returns:
- referenced array value
Throws:
java.lang.IllegalArgumentException- thrown if called on non-1D array
getDoubleValue
public double getDoubleValue(int[] index)
Gets an element as a double.
Parameters:
index- nD array index
Returns:
- referenced array value
setValue
public void setValue(int[] index,
PHXDouble val)
Sets an element as a PHXDouble object.
Specified by:
setValuein class PHXSimpleArray
Parameters:
index- nD array indexval- value to set
setValue
public void setValue(int index,
double val)
Sets an element as a double.
Parameters:
index- 1D array indexval- value to set
setValue
public void setValue(int[] index,
double val)
Sets an element as a double.
Parameters:
index- nD array indexval- value to set
elementFromString
protected java.lang.Object elementFromString(java.lang.String val)
Description copied from class: PHXSimpleArray
Sub-classes must provide an implementation of this function which converts a string form of a single element to Object form. This is only used when the element type does not implement IPHXType or IPHXType2. For primitives, return the wrapper objects.
Specified by:
elementFromStringin class PHXSimpleArray
getMax
public double getMax()
getMin
public double getMin()
getAvg
public double getAvg()
sortReverse
public void sortReverse()
sort
public void sort()
_sort
public void _sort(PHXDoubleArray array,
boolean ascend)
fromObject
public void fromObject(java.lang.Object toRead)
throws PHXInvalidTypeException
Load the value of this object from the specified object. This will read the object and attempt to convert it if it is a known type. If the type isn't recognized, it will throw a PHXInvalidTypeException. If there is an error in conversion, it will also throw a PHXInvalidTypeException.
NOTE: while it might be logical to think you can create a PHX(Type)Array from, say, an array of java.lang.(Type), that is not currently supported. You MUST use the PHX string array formatting style.
Specified by:
fromObjectin class PHXSimpleType
Parameters:
toRead- to object from which to load this objects value.
Throws:
- PHXInvalidTypeException - if the specified object is of an invalid type or there is an error in conversion.
Accept
public <t> T Accept([IPHXType2](IPHXType2.md).IVisitor<t> visitor)
Accept a Visitor.
Specified by:
Acceptin interface IPHXType2
Type Parameters:
T- Type of the result of the visit.
Parameters:
visitor- The visitor to accept.
Returns:
- The results of the visit.
createCopy
public PHXDoubleArray createCopy()
Create a copy of this instance, including the value and metadata.
Specified by:
createCopyin class PHXSimpleType
Returns:
- a newly constructed copy of this instance.