Rice Pastry API

rice.pastry
Interface NodeSetI

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

public interface NodeSetI
extends NodeHandleSet

An interface to a generic set of nodes.

Version:
$Id: NodeSetI.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Andrew Ladd

Method Summary
 NodeHandle get(Id nid)
          Finds the NodeHandle associated with the NodeId.
 NodeHandle get(int i)
          Gets the ith element in the set.
 int getIndex(Id nid)
          Gets the index of the element with the given node id.
 int getIndex(NodeHandle nh)
          Gets the Index attribute of the NodeSetI object
 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, getType, memberHandle, putHandle, removeHandle, serialize
 

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(Id 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(Id 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