- java.lang.Object
-
- org.praxislive.core.Packet
-
- org.praxislive.core.Call
-
- All Implemented Interfaces:
Comparable<Packet>
public final class Call extends Packet
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Value>args()Get the argument list of this Call.static Callcreate(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)Create a Call with Type INVOKE and empty arguments.static Callcreate(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)Create a Call with Type INVOKE.static Callcreate(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)Create a Call with Type INVOKE.static CallcreateQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)Create a Call with Type INVOKE_QUIET and empty empty arguments.static CallcreateQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)Create a Call with Type INVOKE_QUIET.static CallcreateQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)Create a Call with Type INVOKE_QUIET.Callerror(List<Value> args)Create an error return Call for this call, with the given arguments.Callerror(PError error)Create an error return Call for this call, with the given error argument.ControlAddressfrom()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.booleanisError()Query whether this Call is an error message.booleanisReply()Query whether this Call is a reply message.booleanisReplyRequired()Query whether this Call requires a reply.booleanisRequest()Query whether this Call is a request message.intmatchID()ID to match up calls and responses.Callreply()Create a return Call for this call having no arguments.Callreply(List<Value> args)Create a return Call for this call with the given arguments.Callreply(Value arg)Create a return Call for this call with the given argument.ControlAddressto()Get the ControlAddress that this Call should be sent to.StringtoString()String representation of this Call.
-
-
-
Method Detail
-
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. UsematchID()to link up with a request Call.- Returns:
- Call is a reply
-
isError
public boolean isError()
Query whether this Call is an error message. UsematchID()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.
-
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 clockarg- 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 clockargs- 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 clockarg- 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 clockargs- CallArguments- Returns:
- Call
-
-