public final class VId extends U16Id implements Comparable<VId>
Creating instances of VId is done via the static methods
of the class, or by using the predefined constants
NONE or PRESENT.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides UnsignedIntBasedId.equals(java.lang.Object) and UnsignedIntBasedId.hashCode() so that
instances play nicely with the Collection classes.
This class implements the Comparable interface to ensure that
a sorted list of virtual identifiers is presented in an intuitive order.
| Modifier and Type | Field and Description |
|---|---|
static VId |
NONE
A special value denoting the absence of a virtual identifier.
|
static VId |
PRESENT
A special value denoting the presence of a virtual identifier, without
defining the specific value.
|
E_BYTES_BAD_LEN, LENGTH_IN_BYTES, MAX_VALUEidE_BAD, E_NULL_BYTES, E_NULL_STR, E_OOR, MIN_VALUE| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(VId o)
Implements the Comparable interface, to return virtual identifiers in
natural order.
|
static String |
specialName(VId v)
Returns the logical name of the given identifier if it is a
special value; null otherwise.
|
VId |
to12Bits()
Returns the virtual identifier equivalent to this one with the
top 4 bits zeroed out.
|
String |
toString()
Returns a string representation of this id.
|
static VId |
valueOf(byte[] bytes)
Returns an object that represents the virtual identifier
defined by the specified byte array.
|
static VId |
valueOf(int vid)
Returns an object that represents the virtual identifier
defined by the specified integer.
|
static VId |
valueOf(String vidStr)
Returns an object that represents the virtual identifier
defined by the specified string.
|
rangeCheck, toByteArrayequals, hashCode, toIntparseIntStr, parseLongStrgetRefQ, keyFromBytespublic static final VId NONE
public static final VId PRESENT
public VId to12Bits()
0x0fff.public int compareTo(VId o)
compareTo in interface Comparable<VId>o - the other identifierComparable.compareTo(T)public String toString()
UnsignedIntBasedIdtoString in class UnsignedIntBasedIdpublic static VId valueOf(int vid)
vid - the virtual id numberIllegalArgumentException - if the id number is invalidpublic static VId valueOf(String vidStr)
vidStr - the virtual id number as a stringIllegalArgumentException - if the string is invalidNullPointerException - if the string is nullpublic static VId valueOf(byte[] bytes)
U16Id.LENGTH_IN_BYTES bytes long.bytes - the encoded idNullPointerException - if the byte array is nullIllegalArgumentException - if the byte array is not 2 bytes longCopyright © 2014. All Rights Reserved.