Package jmri.jmrix
Class AbstractMRReply
java.lang.Object
jmri.jmrix.AbstractMessage
jmri.jmrix.AbstractMRReply
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
AcelaReply,CanReply,Dcc4PcReply,DCCppReply,EasyDccReply,EcosReply,GridConnectReply,IEEE802154Reply,JMRIClientReply,MarklinReply,NceReply,Reply,Reply,RfidReply,SerialReply,SerialReply,SerialReply,SerialReply,SerialReply,SerialReply,SerialReply,SpeedoReply,SprogReply,SRCPReply,TamsReply,XNetReply,Z21Reply
Abstract base class for replies in a message/reply protocol.
Handles the character manipulation.
This is a variable length reply, which can grow as needed. The length is given by the largest index written so far.
-
Field Summary
FieldsFields inherited from class jmri.jmrix.AbstractMessage
_dataChars, _nDataChars -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new AbstractMRReply instance.Create a new AbstractMRReply instance from a string.Copy a Reply to a new AbstractMRReply instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flush the message.intGet the OpCode.booleanisBinary()Get if the Reply has Binary form flag set.booleanbooleanGet flag for Unsolicited.intintmaxSize()intvoidsetBinary(boolean b) Set flag for if the Reply is Binary form.voidsetElement(int n, int v) Set a single Data Element at a particular index.voidsetOpCode(int i) Set the OpCode.final voidSet flag for Unsolicited to true.protected abstract intskipPrefix(int index) intskipWhiteSpace(int index) toString()intvalue()Methods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.jmrix.Message
toMonitorString
-
Field Details
-
DEFAULTMAXSIZE
- See Also:
-
-
Constructor Details
-
AbstractMRReply
public AbstractMRReply()Create a new AbstractMRReply instance. -
AbstractMRReply
Copy a Reply to a new AbstractMRReply instance.- Parameters:
m- the reply to copy
-
AbstractMRReply
Create a new AbstractMRReply instance from a string.- Parameters:
s- String to use as reply content
-
-
Method Details
-
setElement
Description copied from class:AbstractMessageSet a single Data Element at a particular index.- Specified by:
setElementin interfaceMessage- Overrides:
setElementin classAbstractMessage- Parameters:
n- index of element.v- value of element.
-
setOpCode
Set the OpCode. Sets Element 0 to character value of integer.- Parameters:
i- Opcode value.
-
getOpCode
Get the OpCode.- Returns:
- value of Element 0.
-
flush
Flush the message. Sets number of data characters to 0. Does not reset array length or data. -
isBinary
Get if the Reply has Binary form flag set.- Returns:
- true if binary, else false.
-
setBinary
Set flag for if the Reply is Binary form.- Parameters:
b- true if binary, else false.
-
setUnsolicited
Set flag for Unsolicited to true. -
isUnsolicited
Get flag for Unsolicited.- Returns:
- true if Unsolicited, else false.
-
isRetransmittableErrorMsg
-
toString
Description copied from interface:Message -
skipPrefix
-
value
-
pollValue
-
match
-
skipWhiteSpace
-
maxSize
-