Rice Pastry API

rice.p2p.multiring
Class MultiringNodeHandleSet

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

public class MultiringNodeHandleSet
extends java.lang.Object
implements NodeHandleSet

Version:
$Id: MultiringNodeHandleSet.java,v 1.2 2005/03/11 00:58:01 jeffh Exp $
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

Parameters:
ringId - DESCRIBE THE PARAMETER
set - DESCRIBE THE PARAMETER
Method Detail

getSet

protected NodeHandleSet getSet()
Returns the internal set

Returns:
The internal set

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.

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 - DESCRIBE THE EXCEPTION

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.

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:
id - DESCRIBE THE PARAMETER
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.

equals

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

Parameters:
o - DESCRIBE THE PARAMETER
Returns:
Equals

hashCode

public int hashCode()
Returns the hashCode

Returns:
hashCode

toString

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

Returns:
A string

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection