com.arjuna.ats.arjuna.common
Class Uid

java.lang.Object
  extended bycom.arjuna.ats.arjuna.common.Uid
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Uid
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Implements a unique identity class.

Since:
1.0.
Version:
$Id: Uid.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)
See Also:
Serialized Form

Constructor Summary
Uid()
          Create a new instance.
Uid(java.lang.String uidString)
          Create Uid from string representation.
Uid(java.lang.String uidString, boolean errsOk)
          Create Uid from string representation.
Uid(Uid copyFrom)
          Create a copy of the specified identifier.
 
Method Summary
 java.lang.Object clone()
          Create a copy of this instance.
 void copy(Uid toCopy)
          Copy the specified Uid over this instance.
 boolean equals(java.lang.Object o)
          Override Object.equals
 boolean equals(Uid u)
           
 java.lang.String fileStringForm()
           
 boolean greaterThan(Uid u)
           
 int hashCode()
          Override Object.hashCode.
static Uid lastResourceUid()
          Return a last resource Uid (0:0:0:1)
 boolean lessThan(Uid u)
           
static Uid maxUid()
          Return the maximum Uid (7fffffff:7fffffff:7fffffff:7fffffff)
static Uid minUid()
          Return the minimum Uid (-80000000:-80000000:-80000000:-80000000)
 boolean notEquals(Uid u)
           
static Uid nullUid()
          Return a null Uid (0:0:0:0)
 void pack(OutputBuffer packInto)
          Routines to pack and unpack Uids into Buffers (for RPC, storage etc)
 void print(java.io.PrintStream strm)
          Print a human-readable form of the Uid.
 java.lang.String stringForm()
           
 java.lang.String toString()
          Same as stringForm()
 void unpack(InputBuffer unpackFrom)
           
 boolean valid()
          Is the Uid valid?
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Uid

public Uid()
Create a new instance.


Uid

public Uid(Uid copyFrom)
Create a copy of the specified identifier.


Uid

public Uid(java.lang.String uidString)
Create Uid from string representation. If the string does not represent a valid Uid then the instance will be set to nullUid.


Uid

public Uid(java.lang.String uidString,
           boolean errsOk)
Create Uid from string representation. boolean arg says whether to give up if an error is detected or to simply replace with nullUid.

Method Detail

hashCode

public int hashCode()
Override Object.hashCode. We always return a positive value.


pack

public void pack(OutputBuffer packInto)
          throws java.io.IOException
Routines to pack and unpack Uids into Buffers (for RPC, storage etc)

Throws:
java.io.IOException

unpack

public void unpack(InputBuffer unpackFrom)
            throws java.io.IOException
Throws:
java.io.IOException

print

public void print(java.io.PrintStream strm)
Print a human-readable form of the Uid.


stringForm

public java.lang.String stringForm()

fileStringForm

public java.lang.String fileStringForm()
Returns:
a string representation of the Uid with all : replaced by _ so that the name may be used as a file name.

toString

public java.lang.String toString()
Same as stringForm()


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a copy of this instance.

Throws:
java.lang.CloneNotSupportedException

copy

public void copy(Uid toCopy)
Copy the specified Uid over this instance.


equals

public boolean equals(java.lang.Object o)
Override Object.equals


equals

public boolean equals(Uid u)

notEquals

public boolean notEquals(Uid u)

lessThan

public boolean lessThan(Uid u)

greaterThan

public boolean greaterThan(Uid u)

valid

public final boolean valid()
Is the Uid valid?


nullUid

public static final Uid nullUid()
Return a null Uid (0:0:0:0)


lastResourceUid

public static final Uid lastResourceUid()
Return a last resource Uid (0:0:0:1)


maxUid

public static final Uid maxUid()
Return the maximum Uid (7fffffff:7fffffff:7fffffff:7fffffff)


minUid

public static final Uid minUid()
Return the minimum Uid (-80000000:-80000000:-80000000:-80000000)