public final class AID
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
copyTo(byte[] array,
int offset)
Copies this AID to a byte array with some offset.
|
boolean |
equals(java.lang.Object o) |
static AID |
from(byte[] bytes)
Create an AID from its bytes
|
static AID |
from(byte[] bytes,
int offset)
Create an AID from a portion of a byte array
|
static AID |
from(RadixHash hash,
java.util.Set<java.lang.Long> shards)
Create an AID from a hash and a set of shards
The AID will contain 192 first bits of shard + 64 bits of selected shard
|
static AID |
from(java.lang.String hexBytes)
Create an AID from its hex bytes
|
byte[] |
getBytes()
Gets the underlying bytes of this AID.
|
long |
getLow()
Gets the lowest 4 bytes of this AID as a long.
|
long |
getShard()
Gets the shard encoded in this AID.
|
int |
hashCode() |
boolean |
isZero()
Checks whether this AID is zero.
|
static java.util.Comparator<AID> |
lexicalComparator()
Get a lexical comparator for this type.
|
java.lang.String |
toString() |
public static final int BYTES
public static final AID ZERO
public long getLow()
public long getShard()
public boolean isZero()
public void copyTo(byte[] array, int offset)
array
- The arrayoffset
- The offset into that arraypublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public byte[] getBytes()
public static AID from(RadixHash hash, java.util.Set<java.lang.Long> shards)
hash
- The hashshards
- The shardspublic static AID from(byte[] bytes)
bytes
- The bytes (must be of length AID.BYTES)public static AID from(byte[] bytes, int offset)
bytes
- The bytes (must be of length AID.BYTES)offset
- The offset into the bytes arraypublic static AID from(java.lang.String hexBytes)
hexBytes
- The bytes in hex (must be of length AID.BYTES * 2)public static java.util.Comparator<AID> lexicalComparator()