Module com.github.f4b6a3.uuid
Interface ClockSeqFunction
-
- All Superinterfaces:
LongUnaryOperator
- All Known Implementing Classes:
DefaultClockSeqFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ClockSeqFunction extends LongUnaryOperator
Function that must return a number between 0 and 16383 (2^14-1).It receives as argument a number of 100-nanoseconds since 1970-01-01 (Unix epoch).
Example:
// A function that returns new random clock sequences ClockSeqFunction f = t -> ClockSeqFunction.getRandom();
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classClockSeqFunction.ClockSeqPoolNested class that manages a pool of 16384 clock sequence values.
-
Method Summary
Static Methods Modifier and Type Method Description static longgetRandom()Returns a new random clock sequence in the range 0 to 16383 (2^14-1).static longtoExpectedRange(long clockseq)Clears the leading bits so that the resulting number is within the range 0 to 16383 (2^14-1).-
Methods inherited from interface java.util.function.LongUnaryOperator
andThen, applyAsLong, compose
-
-
-
-
Method Detail
-
getRandom
static long getRandom()
Returns a new random clock sequence in the range 0 to 16383 (2^14-1).- Returns:
- a number in the range 0 to 16383 (2^14-1)
-
toExpectedRange
static long toExpectedRange(long clockseq)
Clears the leading bits so that the resulting number is within the range 0 to 16383 (2^14-1).The result is equivalent to
n % 2^14.- Parameters:
clockseq- a clock sequence- Returns:
- a number in the range 0 to 16383 (2^14-1).
-
-