Package org.astrogrid.samp.hub
Class BasicHubService.MessageId
- java.lang.Object
-
- org.astrogrid.samp.hub.BasicHubService.MessageId
-
- Enclosing class:
- BasicHubService
private static class BasicHubService.MessageId extends java.lang.Object
Encapsulates information about a MessageId. A message ID can be represented as a string, but encodes information which can be retrieved later.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Comparator
AGE_COMPARATOR
private long
birthday_
private static int
CHECK_LENG
private static int
CHECK_SEED
private static java.lang.String
F_SYNCH_FLAG
private boolean
isSynch_
private java.lang.String
senderId_
private java.lang.String
senderTag_
private static java.lang.String
T_SYNCH_FLAG
-
Constructor Summary
Constructors Constructor Description MessageId(java.lang.String senderId, java.lang.String senderTag, boolean isSynch)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
checksum(java.lang.String senderId, java.lang.String senderTag, boolean isSynch)
Returns a checksum string which is a hash of the given arguments.static BasicHubService.MessageId
decode(java.lang.String msgId)
Decodes a msgId string to return the corresponding MessageId object.static java.lang.String
encode(HubClient sender, java.lang.String senderTag, boolean isSynch)
Returns a message ID string corresponding to the arguments.boolean
equals(java.lang.Object o)
java.lang.String
getSenderId()
Returns the sender's public client id.java.lang.String
getSenderTag()
Returns the msgTag attached to the message by the sender.int
hashCode()
boolean
isSynch()
Returns whether the message was sent synchronously.java.lang.String
toString()
Returns the string representation of this MessageId.
-
-
-
Field Detail
-
senderId_
private final java.lang.String senderId_
-
senderTag_
private final java.lang.String senderTag_
-
isSynch_
private final boolean isSynch_
-
birthday_
private final long birthday_
-
T_SYNCH_FLAG
private static final java.lang.String T_SYNCH_FLAG
- See Also:
- Constant Field Values
-
F_SYNCH_FLAG
private static final java.lang.String F_SYNCH_FLAG
- See Also:
- Constant Field Values
-
CHECK_SEED
private static final int CHECK_SEED
-
CHECK_LENG
private static final int CHECK_LENG
- See Also:
- Constant Field Values
-
AGE_COMPARATOR
private static final java.util.Comparator AGE_COMPARATOR
-
-
Method Detail
-
getSenderId
public java.lang.String getSenderId()
Returns the sender's public client id.- Returns:
- sender's id
-
getSenderTag
public java.lang.String getSenderTag()
Returns the msgTag attached to the message by the sender.- Returns:
- msgTag
-
isSynch
public boolean isSynch()
Returns whether the message was sent synchronously.- Returns:
- true iff message was sent using callAndWait
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns the string representation of this MessageId.- Overrides:
toString
in classjava.lang.Object
- Returns:
- message ID string
-
decode
public static BasicHubService.MessageId decode(java.lang.String msgId) throws SampException
Decodes a msgId string to return the corresponding MessageId object. This is the opposite of thetoString()
method.- Parameters:
msgId
- string representation of message ID- Returns:
- new MessageId object
- Throws:
SampException
-
encode
public static java.lang.String encode(HubClient sender, java.lang.String senderTag, boolean isSynch)
Returns a message ID string corresponding to the arguments.- Parameters:
sender
- sender clientsenderTag
- msgTag attached by senderisSynch
- whether message was sent synchronously- Returns:
- string representation of message ID
-
checksum
private static java.lang.String checksum(java.lang.String senderId, java.lang.String senderTag, boolean isSynch)
Returns a checksum string which is a hash of the given arguments.- Parameters:
senderId
- public client id of sendersenderTag
- msgTag attached by senderisSynch
- whether message was sent synchronously- Returns:
- checksum string
-
-