Class NumberSegment
- All Implemented Interfaces:
Serializable, AliasAccessor, LengthAccessor, PayloadAccessor<Long>, PayloadAccessor.PayloadBuilder<Long, PayloadTransmission<Long>>, PayloadAccessor.PayloadMutator<Long>, PayloadAccessor.PayloadProperty<Long>, Resetable, ValueAccessor<Long>, ValueAccessor.ValueBuilder<Long, NumberSegment>, ValueAccessor.ValueMutator<Long>, ValueAccessor.ValueProperty<Long>, Diagnosable, Schemable<DiagnosticOptions>, PayloadSegment<Long>, PayloadTransmission<Long>, Segment, Segment.SegmentMixin, Transmission, Transmission.TransmissionMixin
- Direct Known Subclasses:
SequenceNumberSegment
public class NumberSegment
extends AbstractPayloadSegment<Long>
implements Segment, ValueAccessor.ValueProperty<Long>, ValueAccessor.ValueBuilder<Long, NumberSegment>
The
NumberSegment is an implementation of a Segment carrying
an integer value with a configurable width (in bytes) as payload.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface AliasAccessor
AliasAccessor.AliasBuilder<B>, AliasAccessor.AliasMutator, AliasAccessor.AliasPropertyNested classes/interfaces inherited from interface LengthAccessor
LengthAccessor.LengthBuilder<B>, LengthAccessor.LengthMutator, LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface PayloadAccessor
PayloadAccessor.PayloadBuilder<P,B>, PayloadAccessor.PayloadMutator<P>, PayloadAccessor.PayloadProperty<P> Nested classes/interfaces inherited from interface Segment
Segment.SegmentMixinNested classes/interfaces inherited from interface Transmission
Transmission.TransmissionMixinNested classes/interfaces inherited from interface ValueAccessor
ValueAccessor.ValueBuilder<V,B>, ValueAccessor.ValueMutator<V>, ValueAccessor.ValueProperty<V> -
Field Summary
Fields inherited from class AbstractPayloadSegment
_alias, _payload -
Constructor Summary
ConstructorsConstructorDescriptionNumberSegment(int aNumberWidth) Constructs an emptyNumberSegmentwith aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.NumberSegment(int aNumberWidth, Long aValue) Constructs aNumberSegmentwith the given long payload and aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.NumberSegment(int aNumberWidth, Long aValue, Endianess aEndianess) Constructs aNumberSegmentwith the given long payload and the givenEndianessfor the representation of theNumberSegment's value (payload).NumberSegment(int aNumberWidth, Long aValue, TransmissionMetrics aTransmissionMetrics) Constructs an according instance from the given configuration.NumberSegment(int aNumberWidth, Endianess aEndianess) Constructs an emptyNumberSegmentwith the givenEndianess.NumberSegment(int aNumberWidth, TransmissionMetrics aTransmissionMetrics) Constructs an according instance from the given configuration.NumberSegment(String aAlias, int aNumberWidth) Constructs an emptyNumberSegmentwith aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.NumberSegment(String aAlias, int aNumberWidth, Long aValue) Constructs aNumberSegmentwith the given long payload and aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.NumberSegment(String aAlias, int aNumberWidth, Long aValue, Endianess aEndianess) Constructs aNumberSegmentwith the given long payload and the givenEndianessfor the representation of theNumberSegment's value (payload).NumberSegment(String aAlias, int aNumberWidth, Endianess aEndianess) Constructs an emptyNumberSegmentwith the givenEndianess.NumberSegment(String aAlias, int aNumberWidth, TransmissionMetrics aTransmissionMetrics) Constructs an according instance from the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionintfromTransmission(Sequence aSequence, int aOffset) (Re-)initializes this instance with the the givenSequencedata.intDetermines the overall length of thisTransmission.getValue()voidreset()Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!)voidtoSchema()Provides theSequencerepresentation of thisTransmission.withPayload(Long aValue) Methods inherited from class AbstractPayloadSegment
equals, getAlias, getPayload, hashCode, setPayload, toSimpleTypeTable, toStringMethods inherited from interface PayloadAccessor
getPayloadOrMethods inherited from interface PayloadAccessor.PayloadProperty
letPayloadMethods inherited from interface Segment
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface Segment.SegmentMixin
receiveFromMethods inherited from interface Transmission
toSimpleTypeTable, transmitTo, transmitToMethods inherited from interface Transmission.TransmissionMixin
transmitToMethods inherited from interface ValueAccessor
getValueOr, hasValueMethods inherited from interface ValueAccessor.ValueProperty
letValue
-
Constructor Details
-
NumberSegment
Constructs an according instance from the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
NumberSegment
Constructs an according instance from the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration object, though only those attributes are supported which are also supported by the other constructors!- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.aValue- The payload to be contained by theDoubleArraySection.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
NumberSegment
Constructs an according instance from the given configuration. The configuration attributes are taken from theTransmissionMetricsconfiguration 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.aNumberWidth- The number of bytes to be occupied by the number.aTransmissionMetrics- TheTransmissionMetricsto be used for configuring this instance.
-
NumberSegment
public NumberSegment(int aNumberWidth) Constructs an emptyNumberSegmentwith aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.
-
NumberSegment
Constructs an emptyNumberSegmentwith the givenEndianess.- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.aEndianess- TheEndianessto be used for payload values.
-
NumberSegment
Constructs aNumberSegmentwith the given long payload and aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.aValue- The payload to be contained by theNumberSegment.
-
NumberSegment
Constructs aNumberSegmentwith the given long payload and the givenEndianessfor the representation of theNumberSegment's value (payload).- Parameters:
aNumberWidth- The number of bytes to be occupied by the number.aValue- The value (payload) to be contained by theNumberSegment.aEndianess- TheEndianessto be used for payload values.
-
NumberSegment
Constructs an emptyNumberSegmentwith aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.- Parameters:
aAlias- The alias which identifies the content of this segment.aNumberWidth- The number of bytes to be occupied by the number.
-
NumberSegment
Constructs an emptyNumberSegmentwith the givenEndianess.- Parameters:
aAlias- The alias which identifies the content of this segment.aNumberWidth- The number of bytes to be occupied by the number.aEndianess- TheEndianessto be used for payload values.
-
NumberSegment
Constructs aNumberSegmentwith the given long payload and aTransmissionMetrics.DEFAULT_ENDIANESSendian representation of theNumberSegment's value.- Parameters:
aAlias- The alias which identifies the content of this segment.aNumberWidth- The number of bytes to be occupied by the number.aValue- The payload to be contained by theNumberSegment.
-
NumberSegment
Constructs aNumberSegmentwith the given long payload and the givenEndianessfor the representation of theNumberSegment's value (payload).- Parameters:
aAlias- The alias which identifies the content of this segment.aNumberWidth- The number of bytes to be occupied by the number.aValue- The value (payload) to be contained by theNumberSegment.aEndianess- TheEndianessto be used for payload values.
-
-
Method Details
-
toSequence
Provides theSequencerepresentation of thisTransmission. In case of nestedTransmissioninstances, allSequencerepresentations from all sub-segments are accumulated to the result as well. Caution, the Transmission (or its nestedTransmissioninstances) may be backed by the returnedSequence.- Specified by:
toSequencein interfaceTransmission- Returns:
- The according instance's
Sequence.
-
fromTransmission
(Re-)initializes this instance with the the givenSequencedata.- Specified by:
fromTransmissionin interfaceSegment- Parameters:
aSequence- TheSequencedata from which to (re-)initialize this instance.aOffset- The offset where to start processing the providedSequence.- Returns:
- The index after the last offset into the given
Sequenceprocessed by this method. - Throws:
TransmissionException- thrown in case a givenSequencecannot be processed.
-
getLength
public int getLength()Determines the overall length of thisTransmission. In case of nestedTransmissioninstances, all length values from all sub-segments are accumulated to the result as well.- Specified by:
getLengthin interfaceLengthAccessor- Specified by:
getLengthin interfaceTransmission- 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. theTransmissionMetrics).- Specified by:
resetin interfaceResetable- Specified by:
resetin interfaceTransmission- Overrides:
resetin classAbstractPayloadSegment<Long>
-
toSchema
- Specified by:
toSchemain interfaceSchemable<DiagnosticOptions>
-
withPayload
- Specified by:
withPayloadin interfacePayloadAccessor.PayloadBuilder<Long, PayloadTransmission<Long>>
-
getValue
- Specified by:
getValuein interfaceValueAccessor<Long>
-
setValue
- Specified by:
setValuein interfaceValueAccessor.ValueMutator<Long>
-
withValue
- Specified by:
withValuein interfaceValueAccessor.ValueBuilder<Long, NumberSegment>
-