Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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_
      • CHECK_SEED

        private static final int CHECK_SEED
      • AGE_COMPARATOR

        private static final java.util.Comparator AGE_COMPARATOR
    • Constructor Detail

      • MessageId

        public MessageId​(java.lang.String senderId,
                         java.lang.String senderTag,
                         boolean isSynch)
        Constructor.
        Parameters:
        senderId - client id of the message sender
        senderTag - msgTag provided by the sender
        isSynch - whether the message was sent synchronously or not
    • 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 class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns the string representation of this MessageId.
        Overrides:
        toString in class java.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 the toString() 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 client
        senderTag - msgTag attached by sender
        isSynch - 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 sender
        senderTag - msgTag attached by sender
        isSynch - whether message was sent synchronously
        Returns:
        checksum string