UnCoVer (Using Coverability for Verification)
|
Provides a possibility to enumerate all partitions on a given set of IDs. More...
#include <IDPartitionEnumerator.h>
Public Member Functions | |
IDPartitionEnumerator (vector< IDType > const &idSet) | |
Creates a new IDPartitionEnumerator with the given IDs. More... | |
IDPartitionEnumerator (unordered_set< IDType > const &idSet) | |
Creates a new IDPartitionEnumerator with the given IDs. More... | |
IDPartitionEnumerator (IDPartitionEnumerator &&oldEnum) | |
Moves the data of the given enumerator to a new IDPartitionEnumerator. More... | |
virtual | ~IDPartitionEnumerator () |
Destroy this instance of the enumerator. | |
bool | isValid () const |
Return whether this IDPartitionEnumerator is in a valid state or not. More... | |
bool | ended () const |
Returns true, if all possible IDPartions were enumerated. More... | |
void | reset () |
Resets this enumerator to start the enumeration process from the first element. | |
size_t | baseSetSize () const |
Returns the size of the set of element on which partitions are enumerated. More... | |
IDPartitionEnumerator & | operator++ () |
Computes the next IDPartition in the enumeration. More... | |
IDPartition const & | operator* () const |
Returns the last IDPartition which was computed. More... | |
Private Member Functions | |
IDPartitionEnumerator () | |
Generates an enumerator with no IDs. More... | |
void | throwIfNotValid () const |
Checks if this IDPartitionEnumerator is still valid and throws an InvalidStateException if it is not. | |
Private Attributes | |
size_t | current |
Stores at which index of genPartitionsVec the current IDPartition is stored. | |
size_t | lastNew |
Stores the index of the first element of genPartitionsVec which was not already used to create more coarse IDPartitions. | |
vector< IDPartition * > * | genPartitionsVec |
Stores all enumerated IDPartitions, where the order of the elements is the sequence in which the IDPartitions were computed. | |
unordered_set< IDPartition *, IDPartitionPointerHasher, IDPartitionPointerEquality > * | genPartitionsSet |
Stores all enumerated IDPartitions to avoid enumerating the same IDPartition multiple times. | |
bool | valid |
Stores whether this IDPartitionEnumerator is still valid. | |
Provides a possibility to enumerate all partitions on a given set of IDs.
Initialized with the ID set, it behaves like an iterator independent of any collection (although not satisfying all necessary properties of such). This enumerator can be moved, but cannot be duplicated!
IDPartitionEnumerator | ( | vector< IDType > const & | idSet | ) |
Creates a new IDPartitionEnumerator with the given IDs.
Duplicate IDs in the given collection are ignored.
idSet | a collection of IDs |
IDPartitionEnumerator | ( | unordered_set< IDType > const & | idSet | ) |
Creates a new IDPartitionEnumerator with the given IDs.
idSet | a collection of IDs |
IDPartitionEnumerator | ( | IDPartitionEnumerator && | oldEnum | ) |
Moves the data of the given enumerator to a new IDPartitionEnumerator.
The new IDPartitionEnumerator has the same state as the old enumerator and the old enumerator is invalidated. The old enumerator may now longer be used!
oldEnum | an rvalue reference to an IDPartitionEnumerator |
|
private |
Generates an enumerator with no IDs.
This constructor can/should only be called internally.
size_t baseSetSize | ( | ) | const |
Returns the size of the set of element on which partitions are enumerated.
bool ended | ( | ) | const |
Returns true, if all possible IDPartions were enumerated.
This will be the case as soon as the ++-operator was called and unable to create any further IDPartitions.
bool isValid | ( | ) | const |
Return whether this IDPartitionEnumerator is in a valid state or not.
IDPartition const & operator* | ( | ) | const |
Returns the last IDPartition which was computed.
If the enumerator has ended, this operator will not report an error, but return the (very) last IDPartition computed.
IDPartitionEnumerator & operator++ | ( | ) |
Computes the next IDPartition in the enumeration.
If there are no more IDPartitions, this enumerator is marked to have ended, but does not report an error. If this enumerator has ended, this operator does nothing (including reporting an error!).