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 3613 2007-02-15 14:45:14Z jstewart $
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)
           
 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

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

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

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

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

Parameters:
nid - a node id.
Returns:
true if that node id is in the set, false otherwise.

remove

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

Parameters:
nid - the node to remove.
Returns:
the node handle removed or null if nothing.

size

int size()
Gets the size of the set.

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

getIndex

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

getIndex

int getIndex(NodeHandle nh)
             throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection