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
public abstract class AbstractMRReply extends AbstractMessage
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
Fields Modifier and Type Field Description static int
DEFAULTMAXSIZE
-
Constructor Summary
Constructors Constructor Description AbstractMRReply()
Create a new AbstractMRReply instance.AbstractMRReply(String s)
Create a new AbstractMRReply instance from a string.AbstractMRReply(AbstractMRReply m)
Copy a Reply to a new AbstractMRReply instance. -
Method Summary
Modifier and Type Method Description void
flush()
Flush the message.int
getOpCode()
Get the OpCode.boolean
isBinary()
Get if the Reply has Binary form flag set.boolean
isRetransmittableErrorMsg()
boolean
isUnsolicited()
Get flag for Unsolicited.int
match(String s)
int
maxSize()
int
pollValue()
void
setBinary(boolean b)
Set flag for if the Reply is Binary form.void
setElement(int n, int v)
Set a single Data Element at a particular index.void
setOpCode(int i)
Set the OpCode.void
setUnsolicited()
Set flag for Unsolicited to true.protected abstract int
skipPrefix(int index)
int
skipWhiteSpace(int index)
String
toString()
int
value()
Methods inherited from class jmri.jmrix.AbstractMessage
equals, getElement, getNumDataElements, hashCode
-
Field Details
-
DEFAULTMAXSIZE
- See Also:
- Constant Field Values
-
-
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:AbstractMessage
Set a single Data Element at a particular index.- Specified by:
setElement
in interfaceMessage
- Overrides:
setElement
in 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
-