Branch data Line data Source code
1 : : #include <mutable/IR/Condition.hpp> 2 : : 3 : : 4 : : using namespace m; 5 : : 6 : : 7 : 243 : bool ConditionSet::implied_by(const ConditionSet &other) const 8 : : { 9 [ - + ]: 243 : for (auto &this_entry : this->type2cond_) { 10 : 0 : auto it = other.type2cond_.find(this_entry.first); 11 [ # # ]: 0 : if (it == other.type2cond_.cend()) 12 : 0 : return false; // condition not found 13 [ # # ]: 0 : if (not this_entry.second->implied_by(*it->second)) 14 : 0 : return false; // condition does not imply this condition 15 : : } 16 : 243 : return true; 17 : 243 : } 18 : : 19 : 0 : void ConditionSet::project_and_rename(const std::vector<std::pair<Schema::Identifier, Schema::Identifier>> &old2new) 20 : : { 21 [ # # ]: 0 : for (auto &entry : type2cond_) 22 : 0 : entry.second->project_and_rename(old2new); 23 : 0 : } 24 : : 25 : 0 : bool ConditionSet::operator==(const ConditionSet &other) const 26 : : { 27 [ # # ]: 0 : if (this->type2cond_.size() != other.type2cond_.size()) 28 : 0 : return false; // different number of conditions 29 : : 30 [ # # ]: 0 : for (auto &this_entry : this->type2cond_) { 31 : 0 : auto it = other.type2cond_.find(this_entry.first); 32 [ # # ]: 0 : if (it == other.type2cond_.cend()) 33 : 0 : return false; // condition not found 34 [ # # ]: 0 : if (*this_entry.second != *it->second) 35 : 0 : return false; // condition differs 36 : : } 37 : 0 : return true; 38 : 0 : }