Rice Pastry API

rice.pastry
Interface NodeSetI

All Superinterfaces:
NodeHandleSet, java.io.Serializable
All Known Implementing Classes:
NodeSet, RouteSet, SimilarSet

public interface NodeSetI
extends NodeHandleSet

An interface to a generic set of nodes.

Version:
$Id: NodeSetI.java,v 1.4 2005/03/11 00:58:10 jeffh Exp $
Author:
Andrew Ladd

Method Summary
 NodeHandle get(int i)
          Gets the ith element in the set.
 NodeHandle get(NodeId nid)
          Finds the NodeHandle associated with the NodeId.
 int getIndex(NodeHandle nh)
          Gets the Index attribute of the NodeSetI object
 int getIndex(NodeId nid)
          Gets the index of the element with the given node id.
 boolean member(NodeHandle nh)
          Verifies if the set contains this particular id.
 boolean put(NodeHandle handle)
          Puts a NodeHandle into the set.
 NodeHandle remove(NodeHandle nh)
          Removes a node id and its handle from the set.
 int size()
          Gets the size of the set.
 
Methods inherited from interface rice.p2p.commonapi.NodeHandleSet
getHandle, getHandle, getIndexHandle, memberHandle, putHandle, removeHandle
 

Method Detail

put

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

Parameters:
handle - the handle to put.
Returns:
true if the put succeeded, false otherwise.

get

public NodeHandle get(NodeId nid)
Finds the NodeHandle associated with the NodeId.

Parameters:
nid - a node id.
Returns:
the handle associated with that id or null if no such handle is found.

get

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

Parameters:
i - an index.
Returns:
the handle associated with that id or null if no such handle is found.

member

public boolean member(NodeHandle nh)
Verifies if the set contains this particular id.

Parameters:
nh - DESCRIBE THE PARAMETER
Returns:
true if that node id is in the set, false otherwise.

remove

public NodeHandle remove(NodeHandle nh)
Removes a node id and its handle from the set.

Parameters:
nh - 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.

getIndex

public int getIndex(NodeId nid)
             throws java.util.NoSuchElementException
Gets the index of the element with the given node id.

Parameters:
nid - the node id.
Returns:
the index or throws a NoSuchElementException.
Throws:
java.util.NoSuchElementException - DESCRIBE THE EXCEPTION

getIndex

public int getIndex(NodeHandle nh)
             throws java.util.NoSuchElementException
Gets the Index attribute of the NodeSetI object

Parameters:
nh - DESCRIBE THE PARAMETER
Returns:
The Index value
Throws:
java.util.NoSuchElementException - DESCRIBE THE EXCEPTION

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection