This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/Condition.cpp
Rebecca Schofield a3a354c5f0 cleanup
2015-10-06 23:36:48 -05:00

27 lines
No EOL
649 B
C++
Executable file

#include <iostream>
#include "Attribute.h"
#include "Relation.h"
using namespace std;
Relation equality(string attName, string s, Relation r){
Attribute att = r.getAttributeByName(attName);
vector<Attribute> r_atts = r.getAttributes();
vector<Attribute> new_atts = r_atts;
for (int i = 0; i < new_atts.size(); ++i) {
new_atts[i].clearAllValues();
}
for (int i = 0; i < att.getSize(); ++i) {
if (att[i] == s){
for (int j = 0; j < r_atts.size(); ++j){
new_atts[j].addCell(r_atts[j][i]);
}
}
}
//currently all returned relations are called TEMP
Relation new_r("TEMP", new_atts);
return new_r;
}