|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.xmlstore.routing.Identifier
public class Identifier
An identifier consists of at most IDSIZE bit and it is
always positive. Trying to construct an Identifer outside these boundaries
will throw an IndexOutOfBoundsException.
TODO: Consider converting Identifier to interface.
| Field Summary | |
|---|---|
static int |
IDSIZE
Number of bits in an ID. |
| Constructor Summary | |
|---|---|
Identifier()
Constructs an Identifier with value 0. |
|
Identifier(BigInteger val)
Constructs an Identifier from the specified BigInteger. |
|
Identifier(byte[] val)
Constructs an Identifier from the specified byte array which is interpreted as a positive integer in big-endian order (most significant byte is in the zeroth element) |
|
Identifier(DataInput in)
Constructs an Identifier by reading IDSIZE/8 bytes from the specified DataInput. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
void |
fromStream(DataInput in)
Reads the internal state of the Streamable object from the input stream. |
int |
hashCode()
|
static Identifier |
randomIdentifier()
Returns a random Identifer. |
String |
toBinary()
Returns a binary string representation of this identifier with IDSIZE bits. |
static String |
toBinary(BigInteger val)
Returns a binary string representation of the specified BigInteger with IDSIZE bits. |
byte[] |
toByteArray()
Returns the value of the identifier in a byte array of size IDSIZE/8 in big-endian order (most significant byte
is in the zeroth element). |
void |
toStream(DataOutput out)
Writes the internal state of the Streamable object to the output stream in a format that can later be read by the same Streamble class using the Streamable.fromStream(java.io.DataInput) method. |
String |
toString()
|
BigInteger |
value()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int IDSIZE
final but test program changes this value to
simplify the tests.
| Constructor Detail |
|---|
public Identifier()
public Identifier(byte[] val)
public Identifier(BigInteger val)
public Identifier(DataInput in)
throws IOException
IOException| Method Detail |
|---|
public static Identifier randomIdentifier()
public void fromStream(DataInput in)
throws IOException
StreamableUnsupportedOperationException,
and instead implement a constructor as described above.
fromStream in interface StreamableIOException
public void toStream(DataOutput out)
throws IOException
StreamableStreamable.fromStream(java.io.DataInput) method.
toStream in interface StreamableIOExceptionpublic byte[] toByteArray()
IDSIZE/8 in big-endian order (most significant byte
is in the zeroth element).
IndexOutOfBoundsException - if the identifier is to large to fit
in the arraypublic BigInteger value()
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic String toBinary()
IDSIZE bits.
public static String toBinary(BigInteger val)
IDSIZE bits.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||