UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
IDClosureEnumerator.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef IDCLOSUREENUMERATOR_H_
21 #define IDCLOSUREENUMERATOR_H_
22 
23 #include "../basic_types/IDPartitionEnumerator.h"
24 
25 namespace uncover {
26  namespace rule_engine {
27 
37 
38  public:
39 
47  IDClosureEnumerator(unordered_set<IDType> const& idSet, basic_types::IDPartition const& partition);
48 
56 
60  virtual ~IDClosureEnumerator();
61 
67  bool isValid() const;
68 
74  bool ended() const;
75 
80  void reset();
81 
87 
92  basic_types::IDPartition const& operator*() const;
93 
100  friend std::ostream& operator<< (std::ostream& ost, IDClosureEnumerator const& data);
101 
102  private:
103 
107  void throwIfNotValid() const;
108 
113 
118 
122  bool finished;
123 
124  };
125 
126  } /* namespace rule_engine */
127 } /* namespace uncover */
128 
129 #endif /* IDCLOSUREENUMERATOR_H_ */
void reset()
Resets the computation of this enumerator, such that it will enumerate partitions beginning with the ...
Definition: IDClosureEnumerator.cpp:77
basic_types::IDPartition const & operator*() const
Return the last computed IDPartition.
Definition: IDClosureEnumerator.cpp:107
bool ended() const
Return whether the enumerator has ended, i.e.
Definition: IDClosureEnumerator.cpp:65
virtual ~IDClosureEnumerator()
Destroys this instance of the enumerator.
Definition: IDClosureEnumerator.cpp:56
IDClosureEnumerator(unordered_set< IDType > const &idSet, basic_types::IDPartition const &partition)
Generates a new IDClosureEnumerator for the given ID set and the given partition. ...
Definition: IDClosureEnumerator.cpp:29
This enumerator can be used to enumerate all equivalences on IDs, where the equivalence closure of th...
Definition: IDClosureEnumerator.h:36
bool finished
Stores whether the enumerator finished its computation or not.
Definition: IDClosureEnumerator.h:122
bool isValid() const
Returns whether the enumerator is still valid or not.
Definition: IDClosureEnumerator.cpp:61
Provides a possibility to enumerate all partitions on a given set of IDs.
Definition: IDPartitionEnumerator.h:66
IDClosureEnumerator & operator++()
Computes the next valid IDPartition.
Definition: IDClosureEnumerator.cpp:87
friend std::ostream & operator<<(std::ostream &ost, IDClosureEnumerator const &data)
Prints the most important contents of the given IDClosureEnumerator.
Definition: IDClosureEnumerator.cpp:115
void throwIfNotValid() const
Checks if the enumerator is valid and throws an exception if it is not.
Definition: IDClosureEnumerator.cpp:70
unordered_set< SubIDPartition > IDPartition
An IDPartition is a set of sets of IDs (which is effectively a set of equivalence classes)...
Definition: IDPartition.h:37
basic_types::IDPartitionEnumerator * enumerator
Stores an enumerator to enumerate all possible IDPartitions.
Definition: IDClosureEnumerator.h:112
const basic_types::IDPartition * otherPart
Stores the partition with which the equivalence closure will be formed.
Definition: IDClosureEnumerator.h:117