ePOST 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 2302 2005-03-11 00:58:26Z jeffh $
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)
           
 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

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

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

getIndex

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

ePOST API

Copyright © 2001-2005 - Rice Pastry.