Package com.igormaznitsa.jbbp.model
Class JBBPFieldArrayUShort
java.lang.Object
com.igormaznitsa.jbbp.model.JBBPAbstractField
com.igormaznitsa.jbbp.model.JBBPAbstractArrayField<JBBPFieldUShort>
com.igormaznitsa.jbbp.model.JBBPFieldArrayUShort
- All Implemented Interfaces:
JBBPNamedField,JBBPNumericArray,Serializable,Iterable<JBBPFieldUShort>
public final class JBBPFieldArrayUShort
extends JBBPAbstractArrayField<JBBPFieldUShort>
implements JBBPNumericArray
Describes an unsigned short array.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractField
fieldNameInfo, payload -
Constructor Summary
ConstructorsConstructorDescriptionJBBPFieldArrayUShort(JBBPNamedFieldInfo name, short[] array) The Constructor. -
Method Summary
Modifier and TypeMethodDescriptionshort[]getArray()Get the values as a short array.booleangetAsBool(int index) Get element as boolean.intgetAsInt(int index) Get element as integer.longgetAsLong(int index) Get element as long.getElementAt(int index) Get element from the array for its index.Get the field type in string representation.getValueArrayAsObject(boolean reverseBits) Get the value array as an object.intsize()Get number of elements in the array.Methods inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractArrayField
iteratorMethods inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractField
getFieldName, getFieldPath, getNameInfo, getPayload, setPayloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
JBBPFieldArrayUShort
The Constructor.- Parameters:
name- a field name info, it can be null.array- a value array, it must not be null
-
-
Method Details
-
getArray
public short[] getArray()Get the values as a short array.- Returns:
- the values as a short array.
-
size
public int size()Description copied from class:JBBPAbstractArrayFieldGet number of elements in the array.- Specified by:
sizein classJBBPAbstractArrayField<JBBPFieldUShort>- Returns:
- the array size
-
getElementAt
Description copied from class:JBBPAbstractArrayFieldGet element from the array for its index.- Specified by:
getElementAtin classJBBPAbstractArrayField<JBBPFieldUShort>- Parameters:
index- the array index- Returns:
- the array element for its index
-
getAsInt
public int getAsInt(int index) Description copied from interface:JBBPNumericArrayGet element as integer.- Specified by:
getAsIntin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as integer
-
getAsLong
public long getAsLong(int index) Description copied from interface:JBBPNumericArrayGet element as long.- Specified by:
getAsLongin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as long
-
getAsBool
public boolean getAsBool(int index) Description copied from interface:JBBPNumericArrayGet element as boolean.- Specified by:
getAsBoolin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as boolean
-
getValueArrayAsObject
Description copied from class:JBBPAbstractArrayFieldGet the value array as an object.- Specified by:
getValueArrayAsObjectin classJBBPAbstractArrayField<JBBPFieldUShort>- Parameters:
reverseBits- reverse bit order in values- Returns:
- the value array as an object
-
getTypeAsString
Description copied from class:JBBPAbstractFieldGet the field type in string representation.- Specified by:
getTypeAsStringin classJBBPAbstractField- Returns:
- the string representation of field type, like 'int', 'long', 'bool [123]'
-