|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.net.partition.PartitionSet
public class PartitionSet
PartitionSet is a light-weight data structure that represents a set of partitions that are used in parallel processing. This set quite often accompanies a result of partial parallel execution and is used to determine whether or not the entire set of partitions was successfully processed.
This implementation is not thread-safe.
Constructor Summary | |
---|---|
PartitionSet()
Default constructor (necessary for the ExternalizableLite interface). |
|
PartitionSet(int cPartitions)
Construct an empty partition set with a given count. |
|
PartitionSet(PartitionSet partitions)
Copy constructor: construct a new PartitionSet object equivalent to the specified one. |
Method Summary | |
---|---|
boolean |
add(int nPartition)
Add the specified partition to the set. |
boolean |
add(PartitionSet partitions)
Add the specified PartitionSet to this set. |
int |
cardinality()
Returns the number of marked partitions. |
void |
clear()
Clear the set. |
boolean |
contains(int nPartition)
Check whether or not the specified partition belongs to the set. |
boolean |
contains(PartitionSet partitions)
Check whether or not the specified partition set belongs to this set. |
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one. |
void |
fill()
Fill the set to contain all the partitions. |
boolean |
isEmpty()
Check whether or not the partition set is empty. |
boolean |
isFull()
Check whether or not the partition set is full. |
int |
next(int nPartition)
Return an index of the first marked partition that is more or equals to the specified partition. |
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
boolean |
remove(int nPartition)
Remove the specified partition from the set. |
boolean |
remove(PartitionSet partitions)
Remove the specified PartitionSet from this set. |
boolean |
retain(PartitionSet partitions)
Retain only partitions in this set that are contained in the specified PartitionSet. |
String |
toString()
Returns a string representation of this PartitionSet. |
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
Methods inherited from class com.tangosol.util.BitHelper |
---|
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, toBitString, toBitString, toBitString |
Constructor Detail |
---|
public PartitionSet()
public PartitionSet(int cPartitions)
cPartitions
- the partition countpublic PartitionSet(PartitionSet partitions)
partitions
- the partition set to copyMethod Detail |
---|
public boolean add(int nPartition)
nPartition
- the partition to add
public boolean add(PartitionSet partitions)
partitions
- the PartitionSet to add
public boolean remove(int nPartition)
nPartition
- the partition to remove
public boolean remove(PartitionSet partitions)
partitions
- the PartitionSet to remove
public boolean retain(PartitionSet partitions)
partitions
- the PartitionSet to retain
public boolean contains(int nPartition)
nPartition
- the partition to check
public boolean contains(PartitionSet partitions)
partitions
- the partition set to check
public boolean isEmpty()
public boolean isFull()
public void clear()
public void fill()
public int next(int nPartition)
for (int i = ps.next(0); i >= 0; i = ps.next(i+1)) { // process partition }
nPartition
- the partition to start checking from (inclusive)
IndexOutOfBoundsException
- if the specified partition is invalidpublic int cardinality()
public void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore
the state of this object
IOException
- if an I/O exception occurs
NotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occurspublic boolean equals(Object o)
o
- the object to test for equality
true
if this object is the same as the given one;
false
otherwise.public String toString()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |