Class LongSegment

All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<Long>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<Long,PayloadTransmission<Long>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<Long>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<Long>, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, PayloadSegment<Long>, PayloadTransmission<Long>, Segment, Segment.SegmentMixin, Transmission, Transmission.TransmissionMixin

public class LongSegment extends AbstractPayloadSegment<Long> implements Segment
The LongSegment is an implementation of a Segment carrying in long value as payload.
See Also:
  • Field Details

  • Constructor Details

    • LongSegment

      public LongSegment(TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • LongSegment

      public LongSegment(Long aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aValue - The payload to be contained by the DoubleArraySection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • LongSegment

      public LongSegment(String aAlias, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aAlias - The alias which identifies the content of this instance.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • LongSegment

      public LongSegment(String aAlias, Long aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs an according instance from the given configuration. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aAlias - The alias which identifies the content of this instance.
      aValue - The payload to be contained by the DoubleArraySection.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • LongSegment

      public LongSegment()
      Constructs an empty LongSegment with a TransmissionMetrics.DEFAULT_ENDIANESS endian representation of the LongSegment's value.
    • LongSegment

      public LongSegment(org.refcodes.numerical.Endianess aEndianess)
      Constructs an empty LongSegment with the given Endianess.
      Parameters:
      aEndianess - The Endianess to be used for payload values.
    • LongSegment

      public LongSegment(Long aValue)
      Constructs a LongSegment with the given long payload and a TransmissionMetrics.DEFAULT_ENDIANESS endian representation of the LongSegment's value.
      Parameters:
      aValue - The payload to be contained by the LongSegment.
    • LongSegment

      public LongSegment(Long aValue, org.refcodes.numerical.Endianess aEndianess)
      Constructs a LongSegment with the given long payload and the given Endianess for the representation of the LongSegment's value (payload).
      Parameters:
      aValue - The value (payload) to be contained by the LongSegment.
      aEndianess - The Endianess to be used for payload values.
    • LongSegment

      public LongSegment(String aAlias)
      Constructs an empty LongSegment with a TransmissionMetrics.DEFAULT_ENDIANESS endian representation of the LongSegment's value.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
    • LongSegment

      public LongSegment(String aAlias, org.refcodes.numerical.Endianess aEndianess)
      Constructs an empty LongSegment with the given Endianess.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aEndianess - The Endianess to be used for payload values.
    • LongSegment

      public LongSegment(String aAlias, Long aValue)
      Constructs a LongSegment with the given long payload and a TransmissionMetrics.DEFAULT_ENDIANESS endian representation of the LongSegment's value.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The payload to be contained by the LongSegment.
    • LongSegment

      public LongSegment(String aAlias, Long aValue, org.refcodes.numerical.Endianess aEndianess)
      Constructs a LongSegment with the given long payload and the given Endianess for the representation of the LongSegment's value (payload).
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The value (payload) to be contained by the LongSegment.
      aEndianess - The Endianess to be used for payload values.
  • 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.
      Specified by:
      toSequence in interface Transmission
      Returns:
      The according instance's Sequence.
    • fromTransmission

      public int fromTransmission(Sequence aSequence, int aOffset) throws TransmissionException
      (Re-)initializes this instance with the the given Sequence data.
      Specified by:
      fromTransmission in interface Segment
      Parameters:
      aSequence - The Sequence data from which to (re-)initialize this instance.
      aOffset - The offset where to start processing the provided Sequence.
      Returns:
      The index after the last offset into the given Sequence processed by this method.
      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.
      Specified by:
      getLength in interface org.refcodes.mixin.LengthAccessor
      Specified by:
      getLength in interface Transmission
      Returns:
      The (overall) length of the Transmission (including any sub-segments).
    • reset

      public void reset()
      Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!) reset any configurations or settings required to produce the dynamic data (e.g. the TransmissionMetrics).
      Specified by:
      reset in interface org.refcodes.mixin.Resetable
      Specified by:
      reset in interface Transmission
      Overrides:
      reset in class AbstractPayloadSegment<Long>
    • toSchema

      public SerialSchema toSchema()
      Specified by:
      toSchema in interface org.refcodes.mixin.Schemable
      Specified by:
      toSchema in interface Transmission
    • withPayload

      public LongSegment withPayload(Long aValue)
      Specified by:
      withPayload in interface org.refcodes.mixin.PayloadAccessor.PayloadBuilder<Long,PayloadTransmission<Long>>