|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrice.pastry.IdSet
public final class IdSet
Represents a set of Pastry ids. needs to be final otherwise: clone method does not call super.clone() This non-final class defines a clone() method that does not call super. clone(). If this class ("A") is extended by a subclass ("B"), and the subclass B calls super.clone(), then it is likely that B's clone() method will return an object of type A, which violates the standard contract for clone(). If all clone() methods call super.clone(), then they are guaranteed to use Object.clone(), which always returns an object of the correct type.
| Constructor Summary | |
|---|---|
IdSet()
Constructor. |
|
IdSet(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()
Override clone() to make it publicly accessible |
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 |
Id |
maxMember()
return the largest member id |
Id |
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 |
IdSet |
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 |
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 |
|---|
public IdSet()
public IdSet(java.util.SortedMap s)
s - the TreeSet based on which we construct a new IdSet| Method Detail |
|---|
public int numElements()
numElements in interface IdSetpublic void addMember(Id id)
id - the id to addpublic void removeMember(Id id)
id - the id to removepublic boolean isMember(Id id)
id - the id to test
public Id minMember()
public Id maxMember()
public IdSet subSet(Id from,
Id to)
from - the counterclockwise end of the range (inclusive)to - the clockwise end of the range (exclusive)
public IdSet subSet(IdRange range)
range - the range
public java.util.Iterator getIterator()
getIterator in interface IdSetpublic byte[] getHash()
public java.lang.String toString()
toString in class java.lang.Objectpublic void addId(Id id)
addId in interface IdSetid - the id to addpublic void removeId(Id id)
removeId in interface IdSetid - the id to removepublic boolean isMemberId(Id id)
isMemberId in interface IdSetid - the id to test
public IdSet build()
build in interface IdSetpublic IdSet subSet(IdRange range)
subSet in interface IdSetfrom - the lower end of the range (inclusive)to - the upper end of the range (exclusive)
public byte[] hash()
hash in interface IdSetpublic Id[] asArray()
asArray in interface IdSetpublic java.lang.Object clone()
IdSet
clone in interface IdSetclone in class java.lang.Object
|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||