mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Condition.cpp
Go to the documentation of this file.
2
3
4using namespace m;
5
6
7bool ConditionSet::implied_by(const ConditionSet &other) const
8{
9 for (auto &this_entry : this->type2cond_) {
10 auto it = other.type2cond_.find(this_entry.first);
11 if (it == other.type2cond_.cend())
12 return false; // condition not found
13 if (not this_entry.second->implied_by(*it->second))
14 return false; // condition does not imply this condition
15 }
16 return true;
17}
18
19void ConditionSet::project_and_rename(const std::vector<std::pair<Schema::Identifier, Schema::Identifier>> &old2new)
20{
21 for (auto &entry : type2cond_)
22 entry.second->project_and_rename(old2new);
23}
24
25bool ConditionSet::operator==(const ConditionSet &other) const
26{
27 if (this->type2cond_.size() != other.type2cond_.size())
28 return false; // different number of conditions
29
30 for (auto &this_entry : this->type2cond_) {
31 auto it = other.type2cond_.find(this_entry.first);
32 if (it == other.type2cond_.cend())
33 return false; // condition not found
34 if (*this_entry.second != *it->second)
35 return false; // condition differs
36 }
37 return true;
38}
‍mutable namespace
Definition: Backend.hpp:10
std::unordered_map< std::type_index, std::unique_ptr< Condition > > type2cond_
‍assigns a unique identifier to each type of Condition
Definition: Condition.hpp:275
bool operator==(const ConditionSet &other) const
Definition: Condition.cpp:25
void project_and_rename(const std::vector< std::pair< Schema::Identifier, Schema::Identifier > > &old2new)
Definition: Condition.cpp:19
bool implied_by(const ConditionSet &other) const
Definition: Condition.cpp:7