ostore.util
Class NodeId

java.lang.Object
  |
  +--ostore.util.NodeId
All Implemented Interfaces:
Cloneable, Comparable, QuickSerializable
Direct Known Subclasses:
MyNodeId

public class NodeId
extends Object
implements QuickSerializable, Comparable, Cloneable

Abstract node identifier. Currently we use 32-bit IPv4 addressed.

Version:
$Id: NodeId.java,v 1.27 2003/09/05 20:41:17 hweather Exp $
Author:
Sean C. Rhea

Nested Class Summary
 class NodeId.BadFormat
           
 
Field Summary
static boolean DEBUG
           
 
Constructor Summary
NodeId()
           
NodeId(InputBuffer buffer)
           
NodeId(int port, InetAddress addr)
          Construct a new NodeId.
NodeId(String peer)
          Read this NodeId in from a string of the same format as produced by toString (), below.
 
Method Summary
 InetAddress address()
          Return the InetAddress associated with this NodeId; does not work under the simulator.
 Object clone()
          Create an exact copy of this NodeId
 int compareTo(Object other)
          Specified by the Comparable interface.
 boolean equals(Object other)
           
 int hashCode()
           
 boolean less_than(NodeId other)
          a.less_than (b) returns true iff a is less than b.
 int port()
           
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

NodeId

public NodeId(int port,
              InetAddress addr)
Construct a new NodeId.

Parameters:
port - The network port; must be between 0 and 65535 inclusive.
addr - The IP address

NodeId

public NodeId(String peer)
       throws NodeId.BadFormat,
              UnknownHostException
Read this NodeId in from a string of the same format as produced by toString (), below.


NodeId

public NodeId()

NodeId

public NodeId(InputBuffer buffer)
       throws QSException
Method Detail

serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Parameters:
buffer - the output buffer to add the object to

address

public InetAddress address()
Return the InetAddress associated with this NodeId; does not work under the simulator.

JUST TO MAKE THAT CLEAR, THIS FUNCTION WILL NOT WORK IN THE OCEANSTORE SIMULATOR. YOU HAVE BEEN WARNED.


port

public int port()

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object other)
Specified by the Comparable interface.

Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object other)
Overrides:
equals in class Object

less_than

public boolean less_than(NodeId other)
a.less_than (b) returns true iff a is less than b. Used for sorting NodeIds.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Create an exact copy of this NodeId

Overrides:
clone in class Object
Returns:
new NodeId identical in value to this one
Throws:
CloneNotSupportedException - if clone() is not supported