- 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 Call
create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)
Create a Call with Type INVOKE and empty arguments.static Call
create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)
Create a Call with Type INVOKE.static Call
create(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)
Create a Call with Type INVOKE.static Call
createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode)
Create a Call with Type INVOKE_QUIET and empty empty arguments.static Call
createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, List<Value> args)
Create a Call with Type INVOKE_QUIET.static Call
createQuiet(ControlAddress toAddress, ControlAddress fromAddress, long timeCode, Value arg)
Create a Call with Type INVOKE_QUIET.Call
error(List<Value> args)
Create an error return Call for this call, with the given arguments.Call
error(PError error)
Create an error return Call for this call, with the given error argument.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.boolean
isError()
Query whether this Call is an error message.boolean
isReply()
Query whether this Call is a reply message.boolean
isReplyRequired()
Query whether this Call requires a reply.boolean
isRequest()
Query whether this Call is a request message.int
matchID()
ID to match up calls and responses.Call
reply()
Create a return Call for this call having no arguments.Call
reply(List<Value> args)
Create a return Call for this call with the given arguments.Call
reply(Value arg)
Create a return Call for this call with the given argument.ControlAddress
to()
Get the ControlAddress that this Call should be sent to.String
toString()
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
-
-