something

This commit is contained in:
Rebecca Schofield 2015-09-15 22:02:16 -05:00
parent c81c80193f
commit 856c73172a

View file

@ -8,20 +8,21 @@ class Relation {
string name; //the name of the relation (table)
vector<Attribute> att;
vector<string> attributeNames;
int size;
public:
//Relation();
void initializeRelation(string n, vector<string> attNames, vector<Attribute> a)
{
void initializeRelation(string n, vector<string> attNames, vector<Attribute> a) {
attributeNames = attNames;
name = n;
att = a;
size = 0;
}
void addTuple(vector< string > tuple) {
int getSize() { return size; }
void addTuple(vector<string> tuple) {
if(tuple.size() != att.size()){
cout << "\n ERROR" << endl;
}
@ -33,8 +34,7 @@ public:
}
}
void removeTuple(int tupleNum)
{
void removeTuple(int tupleNum) {
if (tupleNum > att[0].getSize() || tupleNum < 0)
{
cout<<"ERROR! index out of bound"<<endl;
@ -50,8 +50,7 @@ public:
}
}
void projectQuery(string input)
{
void projectQuery(string input) {
cout << "-----------Initiated Query Projection---------" << endl;
for(int i = 0; i < att.size(); i++) {
if(att[i].getName() == input) {
@ -68,8 +67,7 @@ public:
}
}
void display()
{
void display() {
cout<<"\n\nDisplay of relation--------------------------------"<<endl;
cout<<"Relation name: "<<name<<endl;
for (int i = 0; i < attributeNames.size(); ++i)
@ -80,6 +78,5 @@ public:
att[i].display();
}
}
};