Rice Pastry API

rice.p2p.glacier
Class FragmentKeySet

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

public class FragmentKeySet
extends java.lang.Object
implements IdSet

DESCRIBE THE CLASS

Version:
$Id: FragmentKeySet.java 4654 2009-01-08 16:33:07Z jeffh $
Author:
ahae
See Also:
Serialized Form

Constructor Summary
  FragmentKeySet()
          Constructor.
  FragmentKeySet(FragmentKeySet o)
          Copy constructor.
protected FragmentKeySet(java.util.SortedMap s)
          Constructor.
 
Method Summary
 void addId(Id id)
          add a member
 void addMember(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()
          DESCRIBE THE METHOD
 byte[] getHash()
          compute a fingerprint of the members in this IdSet
 java.util.Iterator<Id> getIterator()
          return an iterator over the elements of this set
 byte[] hash()
          return a hash of this set
 boolean isMember(Id id)
          test membership
 boolean isMemberId(Id id)
          test membership
 FragmentKey maxMember()
          return the largest member id
 FragmentKey minMember()
          return the smallest member id
 int numElements()
          return the number of elements
 void removeId(Id id)
          remove a member
 void removeMember(Id id)
          remove a member
 FragmentKeySet subSet(FragmentKeyRange range)
          return a subset of this set, consisting of the member ids in a given range
 FragmentKeySet subSet(Id from, Id to)
          return a subset of this set, consisting of the member ids in a given range
 IdSet subSet(IdRange range)
          return a subset of this set, consisting of the member ids in a given range
 java.lang.String toString()
          Returns a string representation of the IdSet.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FragmentKeySet

public FragmentKeySet()
Constructor.


FragmentKeySet

public FragmentKeySet(FragmentKeySet o)
Copy constructor. constructs a shallow copy of the given IdSet o.

Parameters:
o - the IdSet to copy

FragmentKeySet

protected FragmentKeySet(java.util.SortedMap s)
Constructor. constructs a shallow copy of the given TreeSet s.

Parameters:
s - the TreeSet based on which we construct a new IdSet
Method Detail

isMember

public boolean isMember(Id id)
test membership

Parameters:
id - the id to test
Returns:
true of id is a member, false otherwise

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

getHash

public byte[] getHash()
compute a fingerprint of the members in this IdSet

Returns:
an Id containing the secure hash of this set

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

numElements

public int numElements()
return the number of elements

Specified by:
numElements in interface IdSet
Returns:
DESCRIBE THE RETURN VALUE

addMember

public void addMember(Id id)
add a member

Parameters:
id - the id to add

removeMember

public void removeMember(Id id)
remove a member

Parameters:
id - the id to remove

minMember

public FragmentKey minMember()
return the smallest member id

Returns:
the smallest id in the set

maxMember

public FragmentKey maxMember()
return the largest member id

Returns:
the largest id in the set

subSet

public FragmentKeySet subSet(Id from,
                             Id to)
return a subset of this set, consisting of the member ids in a given range

Parameters:
from - the counterclockwise end of the range (inclusive)
to - the clockwise end of the range (exclusive)
Returns:
the subset

subSet

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

Parameters:
range - the range
Returns:
the subset

toString

public java.lang.String toString()
Returns a string representation of the IdSet.

Overrides:
toString in class java.lang.Object
Returns:
DESCRIBE THE RETURN VALUE

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

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:
range - DESCRIBE THE PARAMETER
Returns:
the subset

hash

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

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

clone

public java.lang.Object clone()
DESCRIBE THE METHOD

Specified by:
clone in interface IdSet
Overrides:
clone in class java.lang.Object
Returns:
DESCRIBE THE RETURN VALUE

build

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

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

asArray

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

Specified by:
asArray in interface IdSet
Returns:
the array

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection