Class: PHXBooleanArray
Last update: 16.07.2025Package: com.phoenix_int.aserver.types
Class Hierarchy
↳ java.lang.Object
↳ com.phoenix_int.aserver.types.PHXSimpleType
↳ com.phoenix_int.aserver.types.PHXSimpleArray<phxboolean>
↳ com.phoenix_int.aserver.types.PHXBooleanArray
Implemented Interfaces
Declaration
public class PHXBooleanArray
extends PHXSimpleArray<phxboolean>
Class wraps an array of PHXBoolean variables for the ScriptWrapper utility.
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 |
|---|
PHXBooleanArray() |
PHXBooleanArray(java.lang.Object data) |
PHXBooleanArray(PHXBooleanArray other) Clone another PHXBooleanArray'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. |
PHXBooleanArray |
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. |
boolean |
getBooleanValue(int index) Gets the value of an element as a boolean |
boolean |
getBooleanValue(int[] index) Gets the value of an element as a boolean |
[PHXBoolean](PHXBoolean.md) |
getValue(int[] index) Gets the value of an element as a PHXBoolean object |
void |
setValue(int[] index, boolean val) Sets the value of an element as a boolean |
void |
setValue(int[] index, PHXBoolean val) Sets the value of an element as a PHXBoolean object |
void |
setValue(int index, boolean val) Sets the value of an element as a boolean |
Methods inherited from class PHXSimpleArray
_getMetaData, _getMetaData, _setMetaData, _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
PHXBooleanArray
public PHXBooleanArray()
PHXBooleanArray
public PHXBooleanArray(java.lang.Object data)
PHXBooleanArray
public PHXBooleanArray(PHXBooleanArray other)
Parameters:
other- the other PHXBooleanArray 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<phxboolean>
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<phxboolean>
Throws:
java.lang.IllegalAccessExceptionjava.lang.InstantiationException
getValue
public PHXBoolean getValue(int[] index)
Gets the value of an element as a PHXBoolean object.
Specified by:
getValuein classPHXSimpleArray<phxboolean>
Parameters:
index- nD array index
Returns:
- referenced array value
getBooleanValue
public boolean getBooleanValue(int index)
Gets the value of an element as a boolean.
Parameters:
index- 1D array index
Returns:
- referenced array value
Throws:
java.lang.IllegalArgumentException- thrown if called on non-1D array
getBooleanValue
public boolean getBooleanValue(int[] index)
Gets the value of an element as a boolean.
Parameters:
index- nD array index
Returns:
- referenced array value
setValue
public void setValue(int[] index,
PHXBoolean val)
Sets the value of an element as a PHXBoolean object.
Specified by:
setValuein classPHXSimpleArray<phxboolean>
Parameters:
index- nD array indexval- value to set
setValue
public void setValue(int index,
boolean val)
Sets the value of an element as a boolean.
Parameters:
index- 1D array indexval- value to set
Throws:
java.lang.IllegalArgumentException- thrown if called on non-1D array
setValue
public void setValue(int[] index,
boolean val)
Sets the value of an element as a boolean.
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 classPHXSimpleArray<phxboolean>
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 object's 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.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 PHXBooleanArray createCopy()
Create a copy of this instance, including the value and metadata.
Specified by:
createCopyin classPHXSimpleType
Returns:
- a newly constructed copy of this instance.