org.apache.commons.id.uuid.state
Class Node

java.lang.Object
  extended by org.apache.commons.id.uuid.state.Node

public class Node
extends java.lang.Object

The Node class represents the data and accessors for a single node identifier. The node id is generally the IEEE 802 address, the clock sequence, and last timestamp generated are all attributes of a node that need to be maintained.

Version:
$Id: Node.java 480488 2006-11-29 08:57:26Z bayard $
Author:
Commons-Id team

Constructor Summary
Node(byte[] nodeId)
          Constructor used to create a Node when the lastTimestamp and clock sequence are unavailable.
Node(byte[] nodeId, long lastTime, short clockSeq)
          Constructor used to create a Node when all persistent state information is available; node bytes, lastTimestamp, and clock sequence.
 
Method Summary
 boolean equals(java.lang.Object compareTo)
          Returns true if the identifier value in this Node is equal to the identifier value in the compare to Node.
 short getClockSequence()
          Returns the clock sequence used in this node.
 long getLastTimestamp()
          Returns the last uuid timestamp from this Node.
 byte[] getNodeIdentifier()
          Returns the node identifier bytes for this node.
 long getUUIDTime()
          Returns the time in UUID time.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node(byte[] nodeId)

Constructor used to create a Node when the lastTimestamp and clock sequence are unavailable.

Parameters:
nodeId - the byte array representing this nodes identifier. Usually the IEEE 802 address bytes.

Node

public Node(byte[] nodeId,
            long lastTime,
            short clockSeq)

Constructor used to create a Node when all persistent state information is available; node bytes, lastTimestamp, and clock sequence.

Parameters:
nodeId - the byte array representing this nodes identifier. Usually the IEEE 802 address bytes.
lastTime - the last timestamp this Node used.
clockSeq - the last clock sequence used in generation from this node.
Method Detail

getNodeIdentifier

public byte[] getNodeIdentifier()

Returns the node identifier bytes for this node.

Returns:
the node identifier bytes for this node.

getClockSequence

public short getClockSequence()

Returns the clock sequence used in this node.

Returns:
the clock sequence used in this node.

getUUIDTime

public long getUUIDTime()
                 throws OverClockedException

Returns the time in UUID time.

Returns:
the time in UUID time.
Throws:
OverClockedException - the max number of timestamps generated in this interval has been exceeded.

equals

public boolean equals(java.lang.Object compareTo)

Returns true if the identifier value in this Node is equal to the identifier value in the compare to Node.

Overrides:
equals in class java.lang.Object
Parameters:
compareTo - the Node to compare for equivalence.
Returns:
true if the two node's identifiers are equal; otherwise false.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getLastTimestamp

public long getLastTimestamp()

Returns the last uuid timestamp from this Node.

Returns:
the last uuid timestamp from this Node.


Copyright 2003-2008 The Apache Software Foundation. All Rights Reserved.