ePOST API

rice.p2p.glacier
Class VersionKeySet

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

public class VersionKeySet
extends java.lang.Object
implements IdSet

DESCRIBE THE CLASS

Version:
$Id: VersionKeySet.java 2693 2005-08-05 14:00:47Z jeffh $
Author:
ahae
See Also:
Serialized Form

Constructor Summary
  VersionKeySet()
          Constructor.
protected VersionKeySet(java.util.SortedMap s)
          Constructor.
  VersionKeySet(VersionKeySet o)
          Copy 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 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
 VersionKey maxMember()
          return the largest member id
 VersionKey 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
 VersionKeySet 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
 VersionKeySet subSet(VersionKeyRange 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

VersionKeySet

public VersionKeySet()
Constructor.


VersionKeySet

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

Parameters:
o - the IdSet to copy

VersionKeySet

protected VersionKeySet(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 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 VersionKey minMember()
return the smallest member id

Returns:
the smallest id in the set

maxMember

public VersionKey maxMember()
return the largest member id

Returns:
the largest id in the set

subSet

public VersionKeySet 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 VersionKeySet subSet(VersionKeyRange 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

ePOST API

Copyright © 2001-2005 - Rice Pastry.