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.24 2003/03/23 20:55:25 srhea Exp $
- Author:
- Sean C. Rhea
Field Summary |
static boolean |
DEBUG
|
DEBUG
public static final boolean DEBUG
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)
serialize
public void serialize(OutputBuffer buffer)
- Description copied from interface:
QuickSerializable
- Add the object to the
buffer
.
- Specified by:
serialize
in interface QuickSerializable
- Following copied from interface:
ostore.util.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 NodeId
s.
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