Class Call

All Implemented Interfaces:
Comparable<Packet>

public final class Call extends Packet
  • Method Details

    • isRequest

      public boolean isRequest()
      Query whether this Call is a request message.
      Returns:
      Call is a request
    • isReply

      public boolean isReply()
      Query whether this Call is a reply message. Use matchID() to link up with a request Call.
      Returns:
      Call is a reply
    • isError

      public boolean isError()
      Query whether this Call is an error message. Use matchID() to link up with a request Call.
      Returns:
      Call is an error
    • isReplyRequired

      public boolean isReplyRequired()
      Query whether this Call requires a reply. This implies the Call is also a request, although not all request require replies.

      Error messages should usually be sent even if a reply is not required.

      Returns:
      Call requires a reply
    • args

      public List<Value> args()
      Get the argument list of this Call. The returned list is unmodifiable.
      Returns:
      list of arguments
    • to

      public ControlAddress to()
      Get the ControlAddress that this Call should be sent to.
      Returns:
      ControlAddress
    • from

      public ControlAddress from()
      Get the ControlAddress that this Call is being sent from, and if of type INVOKE or INVOKE_QUIET, where RETURN and ERROR calls should be sent.
      Returns:
    • matchID

      public int matchID()
      ID to match up calls and responses. For INVOKE and INVOKE_QUIET calls, this will return the same as getID(). For RETURN and ERROR calls, this ID will match the ID of the invoking call.
      Returns:
      long ID
    • reply

      public Call reply()
      Create a return Call for this call having no arguments.
      Returns:
      return call
    • reply

      public Call reply(Value arg)
      Create a return Call for this call with the given argument.
      Parameters:
      arg - single argument
      Returns:
      return call
    • reply

      public Call reply(List<Value> args)
      Create a return Call for this call with the given arguments.
      Parameters:
      args - arguments
      Returns:
      return call
    • error

      public Call error(PError error)
      Create an error return Call for this call, with the given error argument.
      Parameters:
      error -
      Returns:
      error return call
    • error

      public Call error(List<Value> args)
      Create an error return Call for this call, with the given arguments.
      Parameters:
      args - error arguments
      Returns:
      error return call
    • toString

      public String toString()
      String representation of this Call. Only to be used for debugging purposes. It is not guaranteed to retain the same format.
      Overrides:
      toString in class Object
      Returns:
      String
    • create

      public static Call create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)
      Create a Call with Type INVOKE and empty arguments.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      Returns:
      Call
    • create

      public static Call create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)
      Create a Call with Type INVOKE.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      arg - single Value which will be automatically wrapped in a CallArguments object.
      Returns:
      Call
    • create

      public static Call create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)
      Create a Call with Type INVOKE.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      args - List of arguments
      Returns:
      Call
    • createQuiet

      public static Call createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)
      Create a Call with Type INVOKE_QUIET and empty empty arguments. This indicates that the sender does not require a response (though it might still get one), except in case of error.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      Returns:
      Call
    • createQuiet

      public static Call createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)
      Create a Call with Type INVOKE_QUIET. This indicates that the sender does not require a response (though it might still get one), except in case of error.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      arg - single Value which will be automatically wrapped in a CallArguments object.
      Returns:
      Call
    • createQuiet

      public static Call createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)
      Create a Call with Type INVOKE_QUIET. This indicates that the sender does not require a response (though it might still get one), except in case of error.
      Parameters:
      toAddress - ControlAddress of receiving Control.
      fromAddress - ControlAddress for response.
      timeCode - long nanosecond time relative to hub clock
      args - CallArguments
      Returns:
      Call