@FunctionalInterface public interface NodeIdFunction extends java.util.function.LongSupplier
Example:
// A function that returns new random multicast node identifiers
NodeIdFunction f = () -> NodeIdFunction.getMulticastRandom();
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
getAsLongstatic long getRandom()
static long getMulticastRandom()
static long toExpectedRange(long nodeid)
The result is equivalent to n % 2^48.
nodeid - the node identifierstatic long toMulticast(long nodeid)
It also clears leading bits so that the resulting number is within the range 0 to 2^48-1.
nodeid - the node identifierstatic boolean isMulticast(long nodeid)
nodeid - a node identifierCopyright © 2024. All rights reserved.