Rice Pastry API

rice.p2p.multiring
Class MultiringNodeHandleSet

java.lang.Object
  extended byrice.p2p.multiring.MultiringNodeHandleSet
All Implemented Interfaces:
NodeHandleSet, java.io.Serializable

public class MultiringNodeHandleSet
extends java.lang.Object
implements NodeHandleSet

Version:
$Id: MultiringNodeHandleSet.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  Id ringId
          The handle's ringId
protected  NodeHandleSet set
          The actual node handle set
static short TYPE
          DESCRIBE THE FIELD
 
Constructor Summary
protected MultiringNodeHandleSet(Id ringId, NodeHandleSet set)
          Constructor
  MultiringNodeHandleSet(InputBuffer buf, Endpoint endpoint)
          Constructor for MultiringNodeHandleSet.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines equality
 NodeHandle getHandle(Id id)
          Finds the NodeHandle associated with the NodeId.
 NodeHandle getHandle(int i)
          Gets the ith element in the set.
 int getIndexHandle(Id id)
          Gets the index of the element with the given node id.
protected  NodeHandleSet getSet()
          Returns the internal set
 short getType()
          Gets the Type attribute of the MultiringNodeHandleSet object
 int hashCode()
          Returns the hashCode
 boolean memberHandle(Id id)
          Verifies if the set contains this particular id.
 boolean putHandle(NodeHandle handle)
          Puts a NodeHandle into the set.
 NodeHandle removeHandle(Id id)
          Removes a node id and its handle from the set.
 void serialize(OutputBuffer buf)
          DESCRIBE THE METHOD
 int size()
          Gets the size of the set.
 java.lang.String toString()
          Prints out the string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

set

protected NodeHandleSet set
The actual node handle set


ringId

protected Id ringId
The handle's ringId


TYPE

public static final short TYPE
DESCRIBE THE FIELD

See Also:
Constant Field Values
Constructor Detail

MultiringNodeHandleSet

protected MultiringNodeHandleSet(Id ringId,
                                 NodeHandleSet set)
Constructor

Parameters:
ringId - DESCRIBE THE PARAMETER
set - DESCRIBE THE PARAMETER

MultiringNodeHandleSet

public MultiringNodeHandleSet(InputBuffer buf,
                              Endpoint endpoint)
                       throws java.io.IOException
Constructor for MultiringNodeHandleSet.

Parameters:
buf - DESCRIBE THE PARAMETER
endpoint - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION
Method Detail

getSet

protected NodeHandleSet getSet()
Returns the internal set

Returns:
The internal set

getHandle

public NodeHandle getHandle(Id id)
Finds the NodeHandle associated with the NodeId.

Specified by:
getHandle in interface NodeHandleSet
Parameters:
id - a node id.
Returns:
the handle associated with that id or null if no such handle is found.

getHandle

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

Specified by:
getHandle in interface NodeHandleSet
Parameters:
i - an index.
Returns:
the handle associated with that id or null if no such handle is found.

getIndexHandle

public int getIndexHandle(Id id)
                   throws java.util.NoSuchElementException
Gets the index of the element with the given node id.

Specified by:
getIndexHandle in interface NodeHandleSet
Parameters:
id - the id.
Returns:
the index or throws a NoSuchElementException.
Throws:
java.util.NoSuchElementException - DESCRIBE THE EXCEPTION

getType

public short getType()
Gets the Type attribute of the MultiringNodeHandleSet object

Specified by:
getType in interface NodeHandleSet
Returns:
The Type value

putHandle

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

Specified by:
putHandle in interface NodeHandleSet
Parameters:
handle - the handle to put.
Returns:
true if the put succeeded, false otherwise.

memberHandle

public boolean memberHandle(Id id)
Verifies if the set contains this particular id.

Specified by:
memberHandle in interface NodeHandleSet
Parameters:
id - a node id.
Returns:
true if that node id is in the set, false otherwise.

removeHandle

public NodeHandle removeHandle(Id id)
Removes a node id and its handle from the set.

Specified by:
removeHandle in interface NodeHandleSet
Parameters:
id - 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.

equals

public boolean equals(java.lang.Object o)
Determines equality

Parameters:
o - DESCRIBE THE PARAMETER
Returns:
Equals

hashCode

public int hashCode()
Returns the hashCode

Returns:
hashCode

toString

public java.lang.String toString()
Prints out the string

Returns:
A string

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
DESCRIBE THE METHOD

Specified by:
serialize in interface NodeHandleSet
Parameters:
buf - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection