@Test(expected = IllegalArgumentException.class) public void too_short_string() { Revision.toLong("000000000000"); }
public static long toLong(@Nonnull String str) { try { return toNumber(str.charAt(12)) | toNumber(str.charAt(11)) << 5 | toNumber(str.charAt(10)) << 10 | toNumber(str.charAt(9)) << 15 | toNumber(str.charAt(8)) << 20 | toNumber(str.charAt(7)) << 25 | toNumber(str.charAt(6)) << 30 | toNumber(str.charAt(5)) << 35 | toNumber(str.charAt(4)) << 40 | toNumber(str.charAt(3)) << 45 | toNumber(str.charAt(2)) << 50 | toNumber(str.charAt(1)) << 55 | toNumber(str.charAt(0)) << 60; } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Expected 13 character String, got " + str); } }
Revision implements Comparable<Revision> { public static long toLong(@Nonnull String str) { try { return toNumber(str.charAt(12)) | toNumber(str.charAt(11)) << 5 | toNumber(str.charAt(10)) << 10 | toNumber(str.charAt(9)) << 15 | toNumber(str.charAt(8)) << 20 | toNumber(str.charAt(7)) << 25 | toNumber(str.charAt(6)) << 30 | toNumber(str.charAt(5)) << 35 | toNumber(str.charAt(4)) << 40 | toNumber(str.charAt(3)) << 45 | toNumber(str.charAt(2)) << 50 | toNumber(str.charAt(1)) << 55 | toNumber(str.charAt(0)) << 60; } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Expected 13 character String, got " + str); } } }
Revision implements Comparable<Revision> { public static long toLong(@Nonnull String str) { try { return toNumber(str.charAt(12)) | toNumber(str.charAt(11)) << 5 | toNumber(str.charAt(10)) << 10 | toNumber(str.charAt(9)) << 15 | toNumber(str.charAt(8)) << 20 | toNumber(str.charAt(7)) << 25 | toNumber(str.charAt(6)) << 30 | toNumber(str.charAt(5)) << 35 | toNumber(str.charAt(4)) << 40 | toNumber(str.charAt(3)) << 45 | toNumber(str.charAt(2)) << 50 | toNumber(str.charAt(1)) << 55 | toNumber(str.charAt(0)) << 60; } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Expected 13 character String, got " + str); } } Revision(@Nonnull String rev);  Revision();  Revision(long node);  Revision(long timeSeq, long node); }
Revision implements Comparable<Revision> { public static long toLong(@Nonnull String str) { try { return toNumber(str.charAt(12)) | toNumber(str.charAt(11)) << 5 | toNumber(str.charAt(10)) << 10 | toNumber(str.charAt(9)) << 15 | toNumber(str.charAt(8)) << 20 | toNumber(str.charAt(7)) << 25 | toNumber(str.charAt(6)) << 30 | toNumber(str.charAt(5)) << 35 | toNumber(str.charAt(4)) << 40 | toNumber(str.charAt(3)) << 45 | toNumber(str.charAt(2)) << 50 | toNumber(str.charAt(1)) << 55 | toNumber(str.charAt(0)) << 60; } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Expected 13 character String, got " + str); } } Revision(@Nonnull String rev);  Revision();  Revision(long node);  Revision(long timeSeq, long node); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Revision other); @Override String toString(); static int compareUnsigned(long x, long y); static long newUniqueTime(); static long newUniqueTime(final long currentTimeMillis); static long toLong(@Nonnull String str); @Nonnull static String toString(long val); }
Revision implements Comparable<Revision> { public static long toLong(@Nonnull String str) { try { return toNumber(str.charAt(12)) | toNumber(str.charAt(11)) << 5 | toNumber(str.charAt(10)) << 10 | toNumber(str.charAt(9)) << 15 | toNumber(str.charAt(8)) << 20 | toNumber(str.charAt(7)) << 25 | toNumber(str.charAt(6)) << 30 | toNumber(str.charAt(5)) << 35 | toNumber(str.charAt(4)) << 40 | toNumber(str.charAt(3)) << 45 | toNumber(str.charAt(2)) << 50 | toNumber(str.charAt(1)) << 55 | toNumber(str.charAt(0)) << 60; } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Expected 13 character String, got " + str); } } Revision(@Nonnull String rev);  Revision();  Revision(long node);  Revision(long timeSeq, long node); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Revision other); @Override String toString(); static int compareUnsigned(long x, long y); static long newUniqueTime(); static long newUniqueTime(final long currentTimeMillis); static long toLong(@Nonnull String str); @Nonnull static String toString(long val); static final Revision MIN_VALUE; static final Revision MAX_VALUE; static final long NODE; final long timeSeq; final long node; }