Skip to content

Commit

Permalink
TinyUUID(long, long) removed
Browse files Browse the repository at this point in the history
  • Loading branch information
oboehm committed Dec 19, 2017
1 parent 425c888 commit 9d3eb89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
15 changes: 1 addition & 14 deletions src/main/java/de/jfachwert/util/TinyUUID.java
Expand Up @@ -42,9 +42,6 @@
*/
public class TinyUUID extends AbstractFachwert<UUID> {

private static final BigInteger LIMIT_INT = BigInteger.valueOf(0x100000000L);
private static final BigInteger LIMIT_LONG = LIMIT_INT.multiply(LIMIT_INT);

/** Minimale UUID. */
public static final TinyUUID MIN = new TinyUUID("00000000-0000-0000-0000-000000000000");

Expand Down Expand Up @@ -72,16 +69,6 @@ public TinyUUID(String uuid) {
this(new BigInteger(uuid.replaceAll("-", ""), 16));
}

/**
* Instantiiert eine neue TinyUUID.
*
* @param lower die unteren 64 Bits
* @param upper die oberen 64 Bits
*/
public TinyUUID(long lower, long upper) {
this(BigInteger.valueOf(upper).multiply(LIMIT_LONG).add(BigInteger.valueOf(lower)));
}

/**
* Instantiiert eine neue TinyUUID. Die uebergebene Zahl wird dabei auf
* 128 Bit normalisiert, damit es beim Vergleich keine Ueberraschungen
Expand Down Expand Up @@ -209,7 +196,7 @@ public String toShortString() {
* sein.
*
* @param id z.B. "ix9de14vQgGKwXZUaruCzw"
* @return
* @return a TinyUUID
*/
public static TinyUUID fromString(String id) {
switch (id.length()) {
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/de/jfachwert/util/TinyUUIDTest.java
Expand Up @@ -132,7 +132,10 @@ private void checkGetUUID(UUID uuid) {
public void testGetSignificantBits() {
long lower = 42;
long upper = 21;
TinyUUID id = new TinyUUID(lower, upper);
byte[] bytes = new byte[16];
bytes[15] = (byte) lower;
bytes[7] = (byte) upper;
TinyUUID id = new TinyUUID(bytes);
assertEquals(lower, id.getLeastSignificantBits());
assertEquals(upper, id.getMostSignificantBits());
}
Expand Down

0 comments on commit 9d3eb89

Please sign in to comment.