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.
Note that all PartitionSet operations that take another set as an argument assume that both sets have the same partition count.
Implements
Inherited Members
Namespace: Tangosol.Net.Partition
Assembly: Coherence.dll
Syntax
public class PartitionSet : IPortableObject
Constructors
PartitionSet()
Default constructor (necessary for IPortableObject interface).
Declaration
public PartitionSet()
Methods
Add(int)
Add the specified partition to the set.
Declaration
public bool Add(int nPartition)
Parameters
Type | Name | Description |
---|---|---|
int | nPartition | The partition to add. |
Returns
Type | Description |
---|---|
bool | True if the specified partition was actually added as a result of this call; false otherwise. |
Add(PartitionSet)
Add the specified PartitionSet to this set.
Declaration
public bool Add(PartitionSet partitions)
Parameters
Type | Name | Description |
---|---|---|
PartitionSet | partitions | The PartitionSet to add. |
Returns
Type | Description |
---|---|
bool | True if all of the partitions were actually added as a result of this call; false otherwise. |
Fill()
Fill the set to contain all the partitions.
Declaration
public void Fill()
Next(int)
Return an index of the first marked partition that is greater than or equal to the specified partition. If no such partition exists then -1 is returned.
This method could be used to iterate over all marked partitions:
for (int i = ps.Next(0); i >= 0; i = ps.Next(i+1)) { // process partition }
Declaration
public int Next(int nPartition)
Parameters
Type | Name | Description |
---|---|---|
int | nPartition | The partition to start checking from (inclusive). |
Returns
Type | Description |
---|---|
int | The next marked partition, or -1 if no next marked partition exists in the set |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | If the specified partition is invalid. |
ReadExternal(IPofReader)
Restore the contents of a user type instance by reading its state using the specified IPofReader object.
Declaration
public virtual void ReadExternal(IPofReader reader)
Parameters
Type | Name | Description |
---|---|---|
IPofReader | reader | The IPofReader from which to read the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
ToString()
Returns a string representation of the PartitionSet.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string representation of the PartitionSet. |
Overrides
WriteExternal(IPofWriter)
Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.
Declaration
public virtual void WriteExternal(IPofWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IPofWriter | writer | The IPofWriter to which to write the object's state. |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
getTrailingZeroCount(long)
Determine the number of trailing zero bits in the passed long value.
Declaration
protected static int getTrailingZeroCount(long l)
Parameters
Type | Name | Description |
---|---|---|
long | l | A long value. |
Returns
Type | Description |
---|---|
int | The number of trailing zero bits in the value, from 0 (indicating that the least significant bit is set) to 64 (indicating that no bits are set). |