Class BooleanArraySection

java.lang.Object
org.refcodes.serial.AbstractPayloadSection<boolean[]>
org.refcodes.serial.BooleanArraySection
All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<boolean[]>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<boolean[],PayloadTransmission<boolean[]>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<boolean[]>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<boolean[]>, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, PayloadSection<boolean[]>, PayloadTransmission<boolean[]>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin

public class BooleanArraySection extends AbstractPayloadSection<boolean[]>
The BooleanArraySection is an implementation of a Section carrying a boolean array as payload. As the boolean array is mapped as a bit field (and the boolean array's length is not necessarily a multiple of 8) into a byte array, we prefix the modulo 8 value of the length of the boolean array when working with binary representations as of the Section interface.
See Also:
  • Constructor Details

    • BooleanArraySection

      public BooleanArraySection()
      Constructs an empty BooleanArraySection.
    • BooleanArraySection

      public BooleanArraySection(boolean... aValue)
      Constructs a BooleanArraySection with the given boolean array payload.
      Parameters:
      aValue - The array (payload) to be contained by the BooleanArraySection.
    • BooleanArraySection

      public BooleanArraySection(Boolean... aValue)
      Constructs a BooleanArraySection with the given boolean array payload.
      Parameters:
      aValue - The array (payload) to be contained by the BooleanArraySection.
    • BooleanArraySection

      public BooleanArraySection(String aAlias)
      Constructs an empty BooleanArraySection.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
    • BooleanArraySection

      public BooleanArraySection(String aAlias, boolean... aValue)
      Constructs a BooleanArraySection with the given boolean array payload.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The array (payload) to be contained by the BooleanArraySection.
    • BooleanArraySection

      public BooleanArraySection(String aAlias, Boolean... aValue)
      Constructs a BooleanArraySection with the given boolean array payload.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The array (payload) to be contained by the BooleanArraySection.
  • Method Details

    • toSequence

      public Sequence toSequence()
      Provides the Sequence representation of this Transmission. In case of nested Transmission instances, all Sequence representations from all sub-segments are accumulated to the result as well. Caution, the Transmission (or its nested Transmission instances) may be backed by the returned Sequence.
      Returns:
      The according instance's Sequence.
    • fromTransmission

      public void fromTransmission(Sequence aSequence, int aOffset, int aLength) throws TransmissionException
      (Re-)initializes this instance with the the given Sequence data.
      Parameters:
      aSequence - The Sequence data from which to (re-)initialize this instance.
      aOffset - The offset where to start processing the provided Sequence.
      aLength - The length of data assigned by the Sequence.
      Throws:
      TransmissionException - thrown in case a given Sequence cannot be processed.
    • getLength

      public int getLength()
      Determines the overall length of this Transmission. In case of nested Transmission instances, all length values from all sub-segments are accumulated to the result as well.
      Returns:
      The (overall) length of the Transmission (including any sub-segments).
    • toSchema

      public SerialSchema toSchema()
    • toString

      public String toString()
      Overrides:
      toString in class AbstractPayloadSection<boolean[]>
    • withPayload

      public BooleanArraySection withPayload(boolean[] aValue)
    • setPayload

      public void setPayload(Boolean[] aPayload)
      Convenience method to convert the array of wrapper types into its counterpart with primitive types before invoking AbstractPayloadSection.setPayload(Object).
      Parameters:
      aPayload - The payload with the wrapper types.
    • withPayload

      public BooleanArraySection withPayload(Boolean[] aPayload)
      Convenience method to convert the array of wrapper types into its counterpart with primitive types before invoking withPayload(boolean[]).
      Parameters:
      aPayload - The payload with the wrapper types.
      Returns:
      This instance as of the builder pattern.