Interface NodeIdFunction

    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static long getMulticastRandom()
      Return a new random multicast node identifier.
      static long getRandom()
      Returns a new random node identifier.
      static boolean isMulticast​(long nodeid)
      Checks if the multicast bit of a node identifier is set.
      static long toExpectedRange​(long nodeid)
      Clears the leading bits so that the resulting number is in the range 0 to 2^48-1.
      static long toMulticast​(long nodeid)
      Sets the multicast bit of a node identifier.
    • Method Detail

      • getRandom

        static long getRandom()
        Returns a new random node identifier.
        Returns:
        a number in the range 0 to 2^48-1.
      • getMulticastRandom

        static long getMulticastRandom()
        Return a new random multicast node identifier.
        Returns:
        a number in the range 0 to 2^48-1.
      • toExpectedRange

        static long toExpectedRange​(long nodeid)
        Clears the leading bits so that the resulting number is in the range 0 to 2^48-1.

        The result is equivalent to n % 2^48.

        Parameters:
        nodeid - the node identifier
        Returns:
        a number in the range 0 to 2^48-1.
      • toMulticast

        static long toMulticast​(long nodeid)
        Sets the multicast bit of a node identifier.

        It also clears leading bits so that the resulting number is within the range 0 to 2^48-1.

        Parameters:
        nodeid - the node identifier
        Returns:
        a node identifier with the multicast bit set
      • isMulticast

        static boolean isMulticast​(long nodeid)
        Checks if the multicast bit of a node identifier is set.
        Parameters:
        nodeid - a node identifier
        Returns:
        true if the node identifier is multicast