Module com.github.f4b6a3.uuid
Class BaseNRemainderEncoder
- java.lang.Object
-
- com.github.f4b6a3.uuid.codec.base.function.BaseNEncoder
-
- com.github.f4b6a3.uuid.codec.base.function.BaseNRemainderEncoder
-
public final class BaseNRemainderEncoder extends BaseNEncoder
Function that encodes a UUID to a base-n string.It encodes using remainder operator (modulus), a common approach to encode integers.
The encoding process is performed using integer arithmetic.
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseNCodec.CustomDividerdividerA custom divider for optimization.-
Fields inherited from class com.github.f4b6a3.uuid.codec.base.function.BaseNEncoder
alphabet, base
-
-
Constructor Summary
Constructors Constructor Description BaseNRemainderEncoder(BaseN base)Constructor with a base-n.BaseNRemainderEncoder(BaseN base, BaseNCodec.CustomDivider divider)Constructor with a base-n and a custom divider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringapply(UUID uuid)protected static long[]divide(long x, BaseNCodec.CustomDivider divider, long rem)Divide a long as unsigned 64 bit integer-
Methods inherited from class com.github.f4b6a3.uuid.codec.base.function.BaseNEncoder
get
-
-
-
-
Field Detail
-
divider
protected final BaseNCodec.CustomDivider divider
A custom divider for optimization.
-
-
Constructor Detail
-
BaseNRemainderEncoder
public BaseNRemainderEncoder(BaseN base)
Constructor with a base-n.- Parameters:
base- a base-n
-
BaseNRemainderEncoder
public BaseNRemainderEncoder(BaseN base, BaseNCodec.CustomDivider divider)
Constructor with a base-n and a custom divider.- Parameters:
base- a base-ndivider- a custom divider
-
-
Method Detail
-
divide
protected static long[] divide(long x, BaseNCodec.CustomDivider divider, long rem)Divide a long as unsigned 64 bit integer- Parameters:
x- a number to be divideddivider- a custom dividerrem- the reminder- Returns:
- an array of longs
-
-