Rice Pastry API

rice.p2p.past.gc
Class GCIdSet

java.lang.Object
  extended by rice.p2p.past.gc.GCIdSet
All Implemented Interfaces:
java.io.Serializable, IdSet

public class GCIdSet
extends java.lang.Object
implements IdSet

Version:
$Id: GCIdSet.java 4654 2009-01-08 16:33:07Z jeffh $
Author:
Alan Mislove, Peter Druschel
See Also:
Serialized Form

Field Summary
protected  IdSet ids
           
protected  java.util.SortedMap timeouts
           
 
Constructor Summary
protected GCIdSet(IdFactory factory)
          Constructor
protected GCIdSet(IdSet set, java.util.SortedMap timeouts)
          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
protected  GCId getGCId(Id id)
           
 java.util.Iterator<Id> getIterator()
          return an iterator over the elements of this 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

ids

protected IdSet ids

timeouts

protected java.util.SortedMap timeouts
Constructor Detail

GCIdSet

protected GCIdSet(IdFactory factory)
Constructor


GCIdSet

protected GCIdSet(IdSet set,
                  java.util.SortedMap timeouts)
Constructor

Method Detail

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<Id> getIterator()
return an iterator over the elements of this set

Specified by:
getIterator in interface IdSet
Returns:
the interator

getGCId

protected GCId getGCId(Id id)

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

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection