ePOST API

rice.p2p.multiring
Class MultiringIdSet

java.lang.Object
  extended by rice.p2p.multiring.MultiringIdSet
All Implemented Interfaces:
java.io.Serializable, IdSet

public class MultiringIdSet
extends java.lang.Object
implements IdSet

Version:
$Id: MultiringIdSet.java 2302 2005-03-11 00:58:26Z jeffh $
Author:
Alan Mislove, Peter Druschel
See Also:
Serialized Form

Field Summary
protected  Id ringId
          The ringId of the ids in the set
protected  IdSet set
          The actual IdSet
 
Constructor Summary
protected MultiringIdSet(Id ringId, IdSet set)
          Constructor
 
Method Summary
 void addId(Id id)
          add a member
 Id[] asArray()
          return this set as an array
 IdSet build()
          Returns a new, empty IdSet of this type
 java.lang.Object clone()
          Clones this object
 boolean equals(java.lang.Object o)
          Determines equality
 java.util.Iterator getIterator()
          return an iterator over the elements of this set
protected  IdSet getSet()
          Returns the internal set
 byte[] hash()
          return a hash of this set
 int hashCode()
          Returns the hashCode
 boolean isMemberId(Id id)
          test membership
 int numElements()
          return the number of elements
 void removeId(Id id)
          remove a member
 IdSet subSet(IdRange range)
          return a subset of this set, consisting of the member ids in a given range
 java.lang.String toString()
          Prints out the string
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

set

protected IdSet set
The actual IdSet


ringId

protected Id ringId
The ringId of the ids in the set

Constructor Detail

MultiringIdSet

protected MultiringIdSet(Id ringId,
                         IdSet set)
Constructor

Method Detail

getSet

protected IdSet getSet()
Returns the internal set

Returns:
The internal set

numElements

public int numElements()
return the number of elements

Specified by:
numElements in interface IdSet

addId

public void addId(Id id)
add a member

Specified by:
addId in interface IdSet
Parameters:
id - the id to add

removeId

public void removeId(Id id)
remove a member

Specified by:
removeId in interface IdSet
Parameters:
id - the id to remove

isMemberId

public boolean isMemberId(Id id)
test membership

Specified by:
isMemberId in interface IdSet
Parameters:
id - the id to test
Returns:
true of id is a member, false otherwise

subSet

public IdSet subSet(IdRange range)
return a subset of this set, consisting of the member ids in a given range

Specified by:
subSet in interface IdSet
Parameters:
from - the lower end of the range (inclusive)
to - the upper end of the range (exclusive)
Returns:
the subset

getIterator

public java.util.Iterator getIterator()
return an iterator over the elements of this set

Specified by:
getIterator in interface IdSet
Returns:
the interator

asArray

public Id[] asArray()
return this set as an array

Specified by:
asArray in interface IdSet
Returns:
the array

hash

public byte[] hash()
return a hash of this set

Specified by:
hash in interface IdSet
Returns:
the hash of this set

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
other - To compare to
Returns:
Equals

hashCode

public int hashCode()
Returns the hashCode

Overrides:
hashCode in class java.lang.Object
Returns:
hashCode

toString

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

Overrides:
toString in class java.lang.Object
Returns:
A string

clone

public java.lang.Object clone()
Clones this object

Specified by:
clone in interface IdSet
Overrides:
clone in class java.lang.Object
Returns:
a clone

build

public IdSet build()
Returns a new, empty IdSet of this type

Specified by:
build in interface IdSet
Returns:
A new IdSet

ePOST API

Copyright © 2001-2005 - Rice Pastry.