public final class Message
extends java.lang.Object
Constructor and Description |
---|
Message(java.lang.String toID,
java.lang.String message)
Creates a new Message object to be sent to a given processor.
|
Message(java.lang.String toID,
java.lang.String message,
boolean isLinkID)
Creates a new Message object to be sent to a given processor or link.
|
Message(java.lang.String toID,
java.lang.String message,
int port)
Creates a new Message object to be set to a given processor on a given port.
|
Message(java.lang.String toID,
java.lang.String message,
int port,
boolean isLinkID)
Creates a new Message object to be sent to a given processor or link on a
given port.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
from()
Gets the processor ID of the processor that sent the message or null if the
message has not yet been sent.
|
java.lang.String |
link()
Gets the link ID of the link that transmitted or will transmit the message
or null if no link ID is set (e.g.
|
java.lang.String |
message()
Gets the message as a string.
|
int |
port()
Gets the port this message was sent to or will be sent to.
|
int |
received()
Gets time (in ticks) that the message was received at or -1 if the message has
not yet been received.
|
int |
senderPort()
The port the algorithm was listening on that sent this message or -1 if the
message has not yet been sent.
|
int |
sent()
Gets time (in ticks) that the message was sent at or -1 if the message has
not yet been sent.
|
int |
size()
Gets the size of the message in bytes.
|
int |
sourcePort()
Deprecated.
duplicate of
senderPort() . |
java.lang.String |
to()
Gets the processor ID of the processor that message was or will be sent to
or null if no processor ID is set (e.g.
|
double |
toDouble()
Attempts to convert the message string into a double.
|
int |
toInt()
Attempts to convert the message string into an integer.
|
long |
toLong()
Attempts to convert the message string into a long.
|
java.lang.String |
toString()
Equivalent to
message() . |
public Message(java.lang.String toID, java.lang.String message)
Algorithm.send(dans.algorithm.Message)
command in the Algorithm
class.toID
- the processor's IDmessage
- the message to be sent.Algorithm.send(dans.algorithm.Message)
,
Message(java.lang.String, java.lang.String, boolean)
,
Message(java.lang.String, java.lang.String, int)
,
Message(java.lang.String, java.lang.String, int, boolean)
public Message(java.lang.String toID, java.lang.String message, int port)
Algorithm.send(dans.algorithm.Message)
command in the Algorithm
class.toID
- the processor's IDmessage
- the message to be sent.port
- the port to send the message to on the target processor.Algorithm.send(dans.algorithm.Message)
,
Message(java.lang.String, java.lang.String)
,
Message(java.lang.String, java.lang.String, boolean)
,
Message(java.lang.String, java.lang.String, int, boolean)
public Message(java.lang.String toID, java.lang.String message, boolean isLinkID)
Algorithm.send(dans.algorithm.Message)
command in the Algorithm
class.toID
- the ID of the processor or link the message is for.message
- the message to be sent.isLinkID
- if toID is a link ID or a processor ID.Algorithm.send(dans.algorithm.Message)
,
Message(java.lang.String, java.lang.String)
,
Message(java.lang.String, java.lang.String, int)
,
Message(java.lang.String, java.lang.String, int, boolean)
public Message(java.lang.String toID, java.lang.String message, int port, boolean isLinkID)
Algorithm.send(dans.algorithm.Message)
command in the Algorithm
class.toID
- the ID of the processor or link the message is for.message
- the message to be sent.port
- the port to send the message to on the target processor.isLinkID
- if toID is a link ID or a processor ID.public final int sent()
public final int received()
public final java.lang.String from()
public final java.lang.String to()
public final java.lang.String link()
public final java.lang.String message()
public final int size()
public final int senderPort()
port()
public final java.lang.String toString()
message()
.toString
in class java.lang.Object
message()
,
toInt()
,
toDouble()
,
toLong()
public final int toInt()
java.lang.NumberFormatException
- if the string does not contain a parsable integer.toString()
,
toDouble()
,
toLong()
public final double toDouble()
java.lang.NumberFormatException
- if the string does not contain a parsable double.toString()
,
toInt()
,
toLong()
public final long toLong()
java.lang.NumberFormatException
- if the string does not contain a parsable long.toString()
,
toInt()
,
toDouble()
public final int port()
senderPort()
public final int sourcePort()
senderPort()
.senderPort()
method. To be removed.senderPort()