Rice Pastry API

rice.pastry
Interface NodeSetI

All Superinterfaces:
NodeHandleSet
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.2 2003/05/09 22:20:06 amislove Exp $
Author:
Andrew Ladd

Method Summary
 rice.pastry.NodeHandle get(int i)
          Gets the ith element in the set.
 rice.pastry.NodeHandle get(rice.pastry.NodeId nid)
          Finds the NodeHandle associated with the NodeId.
 int getIndex(rice.pastry.NodeId nid)
          Gets the index of the element with the given node id.
 boolean member(rice.pastry.NodeId nid)
          Verifies if the set contains this particular id.
 boolean put(rice.pastry.NodeHandle handle)
          Puts a NodeHandle into the set.
 rice.pastry.NodeHandle remove(rice.pastry.NodeId nid)
          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(rice.pastry.NodeHandle handle)
Puts a NodeHandle into the set.

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

get

public rice.pastry.NodeHandle get(rice.pastry.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 rice.pastry.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(rice.pastry.NodeId nid)
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

public rice.pastry.NodeHandle remove(rice.pastry.NodeId nid)
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

public int size()
Gets the size of the set.

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

getIndex

public int getIndex(rice.pastry.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.
java.util.NoSuchElementException

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection