Class PHXObjectArray
Last update: 16.07.2025Packages: com.phoenix_int.aserver.types
↳ java.lang.Object
↳ com.phoenix_int.aserver.types.PHXSimpleType
↳ com.phoenix_int.aserver.types.PHXSimpleArray
↳ com.phoenix_int.aserver.types.PHXObjectArray
All Implemented Interfaces:
public class PHXObjectArray
extends PHXSimpleArray
Placeholder for an array of any random Java Object. This class is useful to keep the system from choking on random array types, but not designed for customer use.
See Also:
Nested Class Summary
Nested classes/interfaces inherited from interface com.phoenix_int.aserver.types.IPHXType2
IPHXType2.IVisitor<t>
Field Summary
Fields inherited from class com.phoenix_int.aserver.types.PHXSimpleArray
_data, _lockDims, _lockResize
Constructor Summary
| Constructor and Description |
|---|
PHXObjectArray() |
PHXObjectArray(java.lang.Object data) |
PHXObjectArray(PHXObjectArrayother)Clone another PHXObjectArray's value and metadata. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
<t> T |
Accept(IPHXType2.IVisitor<t> visitor)Accept a Visitor. |
protected java.lang.Object |
allocateElement(java.lang.Class elementClass)Allocates a single element in a default state. |
PHXObjectArray |
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. |
boolean |
equalsNatural(PHXSimpleTypetoCompare)Compare this PHXSimpleType to another PHXSimpleType. |
void |
fromObject(java.lang.Object toRead)Load the value of this object from the specified object. |
PHXSimpleType |
getValue(int[] index)Gets the value of an element as an object of the appropriate subtype. Must be overridden in subclasses |
void |
setValue(int[] index,PHXSimpleTypeval)Sets an element as an object of the appropriate PHXSimpleType. Must be overridden in subclasses |
Methods inherited from class com.phoenix_int.aserver.types.PHXSimpleArray
_getMetaData, _getMetaData, _setMetaData, _setMetaData, checkRectangular, copy, 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 com.phoenix_int.aserver.types.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
PHXObjectArray
public PHXObjectArray()
PHXObjectArray
public PHXObjectArray(java.lang.Object data)
PHXObjectArray
public PHXObjectArray(PHXObjectArray other)
Clone another PHXObjectArray's value and metadata.
Parameters:
other- the other PHXObjectArray to clone.
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 classPHXSimpleArray
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 classPHXSimpleArray
Throws:
java.lang.IllegalAccessException:java.lang.InstantiationException
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 classPHXSimpleArray
equalsNatural
public boolean equalsNatural(PHXSimpleType toCompare)
throws PHXTypeMismatchException
Compare this PHXSimpleType to another PHXSimpleType. This type of comparison is different than Comparable in that it does a natural comparison between numbers. It is not designed, nor suited, for use in things such as sets, and may behave oddly if put in those circumstances.
Array comparison is handled as follows:
- Compare the number of dimensions between the two arrays
- Compare the length of dimensions between the two arrays
- Compare the values in each of the two arrays
If these three conditions are met, the two arrays are considered naturally equal.
Overrides:
equalsNaturalin classPHXSimpleArray
Parameters:
toCompare-
Returns:
- a negative number if this object is less than toCompare, a positive number if this object is greater than to compare, and zero if these two objects are equal.
Throws:
PHXTypeMismatchException- if the given PHXSimpleType cannot be compared with this object.
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 classPHXSimpleType
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.
getValue
public PHXSimpleType getValue(int[] index)
Gets the value of an element as an object of the appropriate subtype. Must be overridden in subclasses
Specified by:
getValuein classPHXSimpleArray
Parameters:
index- nD array index
Returns:
- referenced array value
setValue
public void setValue(int[] index,
PHXSimpleType val)
Sets an element as an object of the appropriate PHXSimpleType. Must be overridden in subclasses
Specified by:
setValuein classPHXSimpleArray
Parameters:
index- nD array index :val- value to set
Accept
public <t> T Accept(IPHXType2.IVisitor<t> visitor)
Accept a Visitor.
Type Parameters:
T- Type of the result of the visit.
Parameters:
visitor- The visitor to accept.
Returns:
- The results of the visit.
createCopy
public PHXObjectArray createCopy()
Create a copy of this instance, including the value and metadata.
Specified by:
createCopyin classPHXSimpleType
Returns:
- a newly constructed copy of this instance.