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 Details

  • 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

      public void setElement(int n, int v)
      Description copied from class: AbstractMessage
      Set a single Data Element at a particular index.
      Specified by:
      setElement in interface Message
      Overrides:
      setElement in class AbstractMessage
      Parameters:
      n - index of element.
      v - value of element.
    • setOpCode

      public void setOpCode(int i)
      Set the OpCode. Sets Element 0 to character value of integer.
      Parameters:
      i - Opcode value.
    • getOpCode

      public int getOpCode()
      Get the OpCode.
      Returns:
      value of Element 0.
    • flush

      public void flush()
      Flush the message. Sets number of data characters to 0. Does not reset array length or data.
    • isBinary

      public boolean isBinary()
      Get if the Reply has Binary form flag set.
      Returns:
      true if binary, else false.
    • setBinary

      public void setBinary(boolean b)
      Set flag for if the Reply is Binary form.
      Parameters:
      b - true if binary, else false.
    • setUnsolicited

      public final void setUnsolicited()
      Set flag for Unsolicited to true.
    • isUnsolicited

      public boolean isUnsolicited()
      Get flag for Unsolicited.
      Returns:
      true if Unsolicited, else false.
    • isRetransmittableErrorMsg

      public boolean isRetransmittableErrorMsg()
    • toString

      public String toString()
      Description copied from interface: Message
      Specified by:
      toString in interface Message
      Overrides:
      toString in class Object
    • skipPrefix

      protected abstract int skipPrefix(int index)
    • value

      public int value()
    • pollValue

      public int pollValue()
    • match

      public int match(String s)
    • skipWhiteSpace

      public int skipWhiteSpace(int index)
    • maxSize

      public int maxSize()