Class JBBPFieldArrayBit

All Implemented Interfaces:
BitEntity, JBBPNamedField, JBBPNumericArray, Serializable, Iterable<JBBPFieldBit>

public final class JBBPFieldArrayBit extends JBBPAbstractArrayField<JBBPFieldBit> implements BitEntity, JBBPNumericArray
Describes an array contains bit fields.
Since:
1.0
See Also:
  • Constructor Details

    • JBBPFieldArrayBit

      public JBBPFieldArrayBit(JBBPNamedFieldInfo name, byte[] array, JBBPBitNumber bitNumber)
      The Constructor.
      Parameters:
      name - the field name info, it can be null.
      array - the byte array contains values, it must not be null
      bitNumber - number of valuable bits in values of the array, it must not be null
  • Method Details

    • getArray

      public byte[] getArray()
      Get values as a byte array.
      Returns:
      the value array
    • getBitWidth

      public JBBPBitNumber getBitWidth()
      Get the valuable bit number of values in the array.
      Specified by:
      getBitWidth in interface BitEntity
      Returns:
      the valuable bit number, must not be null
    • size

      public int size()
      Description copied from class: JBBPAbstractArrayField
      Get number of elements in the array.
      Specified by:
      size in class JBBPAbstractArrayField<JBBPFieldBit>
      Returns:
      the array size
    • getElementAt

      public JBBPFieldBit getElementAt(int index)
      Description copied from class: JBBPAbstractArrayField
      Get element from the array for its index.
      Specified by:
      getElementAt in class JBBPAbstractArrayField<JBBPFieldBit>
      Parameters:
      index - the array index
      Returns:
      the array element for its index
    • getAsInt

      public int getAsInt(int index)
      Description copied from interface: JBBPNumericArray
      Get element as integer.
      Specified by:
      getAsInt in interface JBBPNumericArray
      Parameters:
      index - index of element in array
      Returns:
      the element as integer
    • getAsLong

      public long getAsLong(int index)
      Description copied from interface: JBBPNumericArray
      Get element as long.
      Specified by:
      getAsLong in interface JBBPNumericArray
      Parameters:
      index - index of element in array
      Returns:
      the element as long
    • getAsBool

      public boolean getAsBool(int index)
      Description copied from interface: JBBPNumericArray
      Get element as boolean.
      Specified by:
      getAsBool in interface JBBPNumericArray
      Parameters:
      index - index of element in array
      Returns:
      the element as boolean
    • getValueArrayAsObject

      public Object getValueArrayAsObject(boolean reverseBits)
      Description copied from class: JBBPAbstractArrayField
      Get the value array as an object.
      Specified by:
      getValueArrayAsObject in class JBBPAbstractArrayField<JBBPFieldBit>
      Parameters:
      reverseBits - reverse bit order in values
      Returns:
      the value array as an object
    • getTypeAsString

      public String getTypeAsString()
      Description copied from class: JBBPAbstractField
      Get the field type in string representation.
      Specified by:
      getTypeAsString in class JBBPAbstractField
      Returns:
      the string representation of field type, like 'int', 'long', 'bool [123]'