Module org.refcodes.serial
Package org.refcodes.serial
Class AbstractInvertibleTransmissionDecorator<DECORATEE extends Transmission>
java.lang.Object
org.refcodes.serial.AbstractTransmissionDecorator<DECORATEE>
org.refcodes.serial.AbstractInvertibleTransmissionDecorator<DECORATEE>
- Type Parameters:
DECORATEE- TheTransmissiontype describing theTransmissionsubclass to be enriched.s
- All Implemented Interfaces:
Serializable,org.refcodes.mixin.DecorateeAccessor<DECORATEE>,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.Resetable,org.refcodes.schema.Schemable,Transmission,Transmission.TransmissionMixin
- Direct Known Subclasses:
InvertibleSectionDecorator,InvertibleSegmentDecorator
public abstract class AbstractInvertibleTransmissionDecorator<DECORATEE extends Transmission>
extends AbstractTransmissionDecorator<DECORATEE>
An abstract implementation of bijective and inverse functions applied to the
decoratee's transmitting and receiving methods.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.DecorateeAccessor
org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE extends Object,B extends org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE, B>>, org.refcodes.mixin.DecorateeAccessor.DecorateeMutator<DECORATEE extends Object>, org.refcodes.mixin.DecorateeAccessor.DecorateeProperty<DECORATEE extends Object> Nested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.refcodes.serial.AbstractTransmissionDecorator
_decoratee -
Constructor Summary
ConstructorsConstructorDescriptionAbstractInvertibleTransmissionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.BijectiveFunction<Byte, Byte> aBijectiveFunction, org.refcodes.numerical.InverseFunction<Byte, Byte> aInverseFunction) Constructs an invertible transmission decorator applying bijective and inverse functions upon the delegated methods.AbstractInvertibleTransmissionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.Invertible<Byte, Byte> aInvertible) Constructs an invertible transmission decorator applying bijective and inverse functions upon the delegated methods. -
Method Summary
Modifier and TypeMethodDescriptiontoSchema()Provides theSequencerepresentation of thisTransmission.voidtransmitTo(OutputStream aOutputStream, InputStream aReturnStream) Transmits theSequencerepresenting the implementing type's instance to the givenOutputStream.Methods inherited from class org.refcodes.serial.AbstractTransmissionDecorator
equals, getDecoratee, getLength, hashCode, reset, toSimpleTypeMap, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.serial.Transmission
transmitTo, transmitTo
-
Field Details
-
_bijectiveFunction
-
_inverseFunction
-
-
Constructor Details
-
AbstractInvertibleTransmissionDecorator
public AbstractInvertibleTransmissionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.Invertible<Byte, Byte> aInvertible) Constructs an invertible transmission decorator applying bijective and inverse functions upon the delegated methods.- Parameters:
aDecoratee- The decorator having applied theInvertible'sBijectiveFunctionto encode and theInvertible'sInverseFunctionto decode any data being delegated.aInvertible- TheInvertibleproviding theBijectiveFunctionto encode and theInvertible'sInverseFunctionto decode any data being delegated.
-
AbstractInvertibleTransmissionDecorator
public AbstractInvertibleTransmissionDecorator(DECORATEE aDecoratee, org.refcodes.numerical.BijectiveFunction<Byte, Byte> aBijectiveFunction, org.refcodes.numerical.InverseFunction<Byte, Byte> aInverseFunction) Constructs an invertible transmission decorator applying bijective and inverse functions upon the delegated methods.- Parameters:
aDecoratee- The decorator having applied theBijectiveFunctionto encode and theInverseFunctionto decode any data being delegated.aBijectiveFunction- TheBijectiveFunctionto encode any data being delegated.aInverseFunction- TheInverseFunctionto decode any data being delegated.
-
-
Method Details
-
transmitTo
Transmits theSequencerepresenting the implementing type's instance to the givenOutputStream. Implementations providing error correction methods use the provided feedbackInputStreamto do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the transmitted data.- Parameters:
aOutputStream- TheOutputStreamwhere to write this instance'sSequenceto.aReturnStream- AnInputStreambeing the return channel to handle "stop-and-wait ARQ" or the like in case of a bidirectional connection. Can be null in case we have a unidirectional connection.- Throws:
IOException- thrown in case writing data to theOutputStreamcaused problems.
-
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- Overrides:
toSequencein classAbstractTransmissionDecorator<DECORATEE extends Transmission>- Returns:
- The according instance's
Sequence.
-
toSchema
-