com.digi.config.util
Class UUID

java.lang.Object
  extended bycom.digi.config.util.UUID
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public final class UUID
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

A universally unique identifier (UUID). This UUID uses 128-bits to form the unique identifier. The most significant long can be decomposed into the following unsigned fields:

 0xFFFFFFFFFFFFFFFF time
 
The least significant long can be decomposed into the following unsigned fields:
 0xFFFFFFFF00000000 random
 0x00000000FFFFFFFF node
 
The time field is a 64-bit timestamp measured in milliseconds since January 1, 1970, 00:00:00 GMT. The random field is set to a 32-bit random number, and The node field is set to an 32-bit IEEE 802 address.

See Also:
Serialized Form

Constructor Summary
UUID()
          Construct a universally unique identifier (UUID).
UUID(long time, int random)
          Construct a UUID based on specified time and random components.
UUID(long mostSig, long leastSig)
          Construct a UUID of a known value
UUID(java.lang.String stringUuid)
          Construct a UUID based on a stringified UUID value.
 
Method Summary
 int compareTo(java.lang.Object o)
          Allows this object to be compared to another object of the same type to determine if it is greater, less than, or equal to it.
 boolean equals(java.lang.Object obj)
          UU IDs are equal if they represent the same 128-bit value.
 long getLeastSignificantBits()
          Returns the least significant 64 bits of the service ID.
 long getMostSignificantBits()
          Returns the most significant 64 bits of the service ID.
 int hashCode()
           
 java.lang.String toString()
          Returns a Stringified version of the UUID
 void writeBytes(java.io.DataOutput out)
          Writes out 16 bytes in standard network byte order.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UUID

public UUID()
Construct a universally unique identifier (UUID). This UUID uses 128-bits to form the unique identifier. The most significant long can be decomposed into the following unsigned fields:
 0xFFFFFFFFFFFFFFFF time
 
The least significant long can be decomposed into the following unsigned fields:
 0xFFFFFFFF00000000 random
 0x00000000FFFFFFFF node
 
The time field is a 64-bit timestamp measured in milliseconds since January 1, 1970, 00:00:00 GMT. The random field is set to a 32-bit random number, and The node field is set to an 32-bit IEEE 802 address.


UUID

public UUID(long time,
            int random)
Construct a UUID based on specified time and random components. The node component will be generated in the normal fashion. Construct a universally unique identifier (UUID) based on user specified time and random components. The node component will be generated in the normal fashion This UUID uses 128-bits to form the unique identifier as follows: The most significant long can be decomposed into the following unsigned fields:
 0xFFFFFFFFFFFFFFFF time
 
The least significant long can be decomposed into the following unsigned fields:
 0xFFFFFFFF00000000 random
 0x00000000FFFFFFFF node
 
The time field is a 64-bit timestamp measured in milliseconds since January 1, 1970, 00:00:00 GMT. The random field is set to a 32-bit random number, and The node field is set to an 32-bit IEEE 802 address.


UUID

public UUID(long mostSig,
            long leastSig)
Construct a UUID of a known value


UUID

public UUID(java.lang.String stringUuid)
Construct a UUID based on a stringified UUID value. This value must have been generated from UUID.toString()

Method Detail

getMostSignificantBits

public long getMostSignificantBits()
Returns the most significant 64 bits of the service ID.


getLeastSignificantBits

public long getLeastSignificantBits()
Returns the least significant 64 bits of the service ID.


writeBytes

public void writeBytes(java.io.DataOutput out)
                throws java.io.IOException
Writes out 16 bytes in standard network byte order.

Parameters:
out - the output stream to write 16 bytes to
Throws:
java.io.IOException

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)
UU IDs are equal if they represent the same 128-bit value.

Returns:
true iff the provided object is a UUID and it's 128-bit value matches our 128-bit value; otherwise return false.

toString

public java.lang.String toString()
Returns a Stringified version of the UUID

Returns:
a String version of the UUID

compareTo

public int compareTo(java.lang.Object o)
Allows this object to be compared to another object of the same type to determine if it is greater, less than, or equal to it. Granted, with UUID the notion of comparable is kind of stupid but were using these as backup compare key in Controllers so we must ensure the items are not reported as the same if just the primary compare keys are the same.

Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2001-2002 Digi International. All Rights Reserved.