Document and clean up UUID factory API and implementation.
[lgpl/argeo-commons.git] / org.argeo.api.uuid / src / org / argeo / api / uuid / NodeIdSupplier.java
index ae9686c7042781348643295ef29f58a302b510b6..94ec50da4b9ff76d3eb86fe94425d6e1ec9dddce 100644 (file)
@@ -4,11 +4,9 @@ import java.util.function.Supplier;
 
 /** A factory for node id base */
 public interface NodeIdSupplier extends Supplier<Long> {
-       long LEAST_SIG_RFC4122_VARIANT = (1l << 63);
-
        static long toNodeIdBase(byte[] node) {
                assert node.length == 6;
-               return LEAST_SIG_RFC4122_VARIANT // base for Leach–Salz UUID
+               return UuidFactory.LEAST_SIG_RFC4122_VARIANT
                                | (node[0] & 0xFFL) //
                                | ((node[1] & 0xFFL) << 8) //
                                | ((node[2] & 0xFFL) << 16) //
@@ -17,4 +15,8 @@ public interface NodeIdSupplier extends Supplier<Long> {
                                | ((node[5] & 0xFFL) << 40); //
        }
 
+       static boolean isNoMacAddressNodeId(byte[] nodeId) {
+               return (nodeId[0] & 1) != 0;
+       }
+
 }