ePOST API

rice.p2p.multiring
Class MultiringNodeHandleSet

java.lang.Object
  extended by rice.p2p.multiring.MultiringNodeHandleSet
All Implemented Interfaces:
java.io.Serializable, NodeHandleSet

public class MultiringNodeHandleSet
extends java.lang.Object
implements NodeHandleSet

Version:
$Id: MultiringNodeHandleSet.java 2302 2005-03-11 00:58:26Z jeffh $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  Id ringId
          The handle's ringId
protected  NodeHandleSet set
          The actual node handle set
 
Constructor Summary
protected MultiringNodeHandleSet(Id ringId, NodeHandleSet set)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines equality
 NodeHandle getHandle(Id id)
          Finds the NodeHandle associated with the NodeId.
 NodeHandle getHandle(int i)
          Gets the ith element in the set.
 int getIndexHandle(Id id)
          Gets the index of the element with the given node id.
protected  NodeHandleSet getSet()
          Returns the internal set
 int hashCode()
          Returns the hashCode
 boolean memberHandle(Id id)
          Verifies if the set contains this particular id.
 boolean putHandle(NodeHandle handle)
          Puts a NodeHandle into the set.
 NodeHandle removeHandle(Id id)
          Removes a node id and its handle from the set.
 int size()
          Gets the size of the set.
 java.lang.String toString()
          Prints out the string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

set

protected NodeHandleSet set
The actual node handle set


ringId

protected Id ringId
The handle's ringId

Constructor Detail

MultiringNodeHandleSet

protected MultiringNodeHandleSet(Id ringId,
                                 NodeHandleSet set)
Constructor

Method Detail

getSet

protected NodeHandleSet getSet()
Returns the internal set

Returns:
The internal set

putHandle

public boolean putHandle(NodeHandle handle)
Puts a NodeHandle into the set.

Specified by:
putHandle in interface NodeHandleSet
Parameters:
handle - the handle to put.
Returns:
true if the put succeeded, false otherwise.

getHandle

public NodeHandle getHandle(Id id)
Finds the NodeHandle associated with the NodeId.

Specified by:
getHandle in interface NodeHandleSet
Parameters:
id - a node id.
Returns:
the handle associated with that id or null if no such handle is found.

getHandle

public NodeHandle getHandle(int i)
Gets the ith element in the set.

Specified by:
getHandle in interface NodeHandleSet
Parameters:
i - an index.
Returns:
the handle associated with that id or null if no such handle is found.

memberHandle

public boolean memberHandle(Id id)
Verifies if the set contains this particular id.

Specified by:
memberHandle in interface NodeHandleSet
Parameters:
id - a node id.
Returns:
true if that node id is in the set, false otherwise.

removeHandle

public NodeHandle removeHandle(Id id)
Removes a node id and its handle from the set.

Specified by:
removeHandle in interface NodeHandleSet
Parameters:
nid - the node to remove.
Returns:
the node handle removed or null if nothing.

size

public int size()
Gets the size of the set.

Specified by:
size in interface NodeHandleSet
Returns:
the size.

getIndexHandle

public int getIndexHandle(Id id)
                   throws java.util.NoSuchElementException
Gets the index of the element with the given node id.

Specified by:
getIndexHandle in interface NodeHandleSet
Parameters:
id - the id.
Returns:
the index or throws a NoSuchElementException.
Throws:
java.util.NoSuchElementException

equals

public boolean equals(java.lang.Object o)
Determines equality

Overrides:
equals in class java.lang.Object
Parameters:
other - To compare to
Returns:
Equals

hashCode

public int hashCode()
Returns the hashCode

Overrides:
hashCode in class java.lang.Object
Returns:
hashCode

toString

public java.lang.String toString()
Prints out the string

Overrides:
toString in class java.lang.Object
Returns:
A string

ePOST API

Copyright © 2001-2005 - Rice Pastry.