Update Parserv3.h

This commit is contained in:
Alex Huddleston 2015-09-22 23:44:51 -05:00
parent 670668124b
commit 6f10af0b32

View file

@ -11,13 +11,20 @@ class Relation
{ {
string name; string name;
public: Relation(string str)
{
name = str;
}
void setRelation(string str)
{
name = str;
}
string getName() string getName()
{ {
return name; return name;
} }
} };
@ -36,7 +43,7 @@ class Union
{ {
return "Union of " + Un1 + " and " + Un2; return "Union of " + Un1 + " and " + Un2;
} }
} };
class Product class Product
{ {
@ -53,9 +60,9 @@ class Product
{ {
return "Product of " + Pr1 + " and " + Pr2; return "Product of " + Pr1 + " and " + Pr2;
} }
} };
class Difference() class Difference
{ {
string D1; string D1;
string D2; string D2;
@ -70,14 +77,14 @@ class Difference()
{ {
return "Difference of " + D1 + " and " + D2; return "Difference of " + D1 + " and " + D2;
} }
} };
class Rename() class Renaming
{ {
string newName; string newName;
string oldName; string oldName;
Rename(string s1, string s2) Renaming(string s1, string s2)
{ {
newName = s1; newName = s1;
oldName = s2; oldName = s2;
@ -87,29 +94,35 @@ class Rename()
{ {
return "Renaming " + oldName + " to " + newName; return "Renaming " + oldName + " to " + newName;
} }
} };
class Projection() class Projection
{ {
string newName; string newName;
string oldName; string oldName;
Rename(string s1, string s2) Projection(string s1, string s2)
{ {
newName = s1; newName = s1;
oldName = s2; oldName = s2;
} }
string doRename() string doProjection()
{ {
return "Projecting " + oldName + " onto " + newName; return "Projecting " + oldName + " onto " + newName;
} }
} };
class Operand() class Operand
{ {
string op; string op;
public:
Operand()
{
}
Operand(string str) Operand(string str)
{ {
op = str; op = str;
@ -124,12 +137,17 @@ class Operand()
{ {
return op; return op;
} }
} };
class Op() class Op
{ {
string op; string op;
public:
Op()
{
}
Op(string str) Op(string str)
{ {
op = str; op = str;
@ -144,14 +162,16 @@ class Op()
{ {
return op; return op;
} }
} };
class Comparison() class Comparison
{ {
Op op; Op op;
Operand operand1; Operand operand1;
Operand operand2; Operand operand2;
public:
Comparison(string str1, string str2, string str3) Comparison(string str1, string str2, string str3)
{ {
operand1.setOperand(str1); operand1.setOperand(str1);
@ -168,14 +188,14 @@ class Comparison()
string getComparison() string getComparison()
{ {
return op1.getOperand() + " " + op.getOp() + " " + op2.getOperand(); return operand1.getOperand() + " " + op.getOp() + " " + operand2.getOperand();
}
} }
};
class Conjunction() class Conjunction
{ {
string conj; string conj;
public:
Conjunction(string str) Conjunction(string str)
{ {
conj = str; conj = str;
@ -190,12 +210,12 @@ class Conjunction()
{ {
return conj; return conj;
} }
} };
class Condition() class Condition
{ {
string cond; string cond;
public:
Condition(string str) Condition(string str)
{ {
cond = str; cond = str;
@ -210,12 +230,12 @@ class Condition()
{ {
return cond; return cond;
} }
} };
class Selection() class Selection
{ {
string select; string select;
public:
Selection(string str) Selection(string str)
{ {
select = str; select = str;
@ -225,18 +245,4 @@ class Selection()
{ {
return select; return select;
} }
} };
class expr
{
Relation r;
selection
projection
renaming
Union
difference
product
}