Update Parserv3.h

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

View file

@ -7,17 +7,24 @@
using namespace std;
class Relation
class Relation
{
string name;
public:
Relation(string str)
{
name = str;
}
void setRelation(string str)
{
name = str;
}
string getName()
{
return name;
}
}
};
@ -36,7 +43,7 @@ class Union
{
return "Union of " + Un1 + " and " + Un2;
}
}
};
class Product
{
@ -53,9 +60,9 @@ class Product
{
return "Product of " + Pr1 + " and " + Pr2;
}
}
};
class Difference()
class Difference
{
string D1;
string D2;
@ -70,14 +77,14 @@ class Difference()
{
return "Difference of " + D1 + " and " + D2;
}
}
};
class Rename()
class Renaming
{
string newName;
string oldName;
Rename(string s1, string s2)
Renaming(string s1, string s2)
{
newName = s1;
oldName = s2;
@ -87,156 +94,155 @@ class Rename()
{
return "Renaming " + oldName + " to " + newName;
}
}
};
class Projection()
class Projection
{
string newName;
string oldName;
Rename(string s1, string s2)
Projection(string s1, string s2)
{
newName = s1;
oldName = s2;
}
string doRename()
string doProjection()
{
return "Projecting " + oldName + " onto " + newName;
}
}
};
class Operand()
class Operand
{
string op;
Operand(string str)
{
op = str;
}
public:
void setOperand(string str)
{
op = str;
}
string getOperand()
{
return op;
}
}
Operand()
{
}
Operand(string str)
{
op = str;
}
void setOperand(string str)
{
op = str;
}
string getOperand()
{
return op;
}
};
class Op()
class Op
{
string op;
Op(string str)
{
op = str;
}
void setOp(string str)
{
op = str;
}
string getOp()
{
return op;
}
}
public:
Op()
{
}
Op(string str)
{
op = str;
}
void setOp(string str)
{
op = str;
}
string getOp()
{
return op;
}
};
class Comparison()
class Comparison
{
Op op;
Operand operand1;
Operand operand2;
Comparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
public:
void setComparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
string getComparison()
{
return op1.getOperand() + " " + op.getOp() + " " + op2.getOperand();
}
}
Comparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
void setComparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
string getComparison()
{
return operand1.getOperand() + " " + op.getOp() + " " + operand2.getOperand();
}
};
class Conjunction()
class Conjunction
{
string conj;
Conjunction(string str)
{
conj = str;
}
void setConjunction(string str)
{
conj = str;
}
string getConjunction()
{
return conj;
}
}
public:
Conjunction(string str)
{
conj = str;
}
void setConjunction(string str)
{
conj = str;
}
string getConjunction()
{
return conj;
}
};
class Condition()
class Condition
{
string cond;
Condition(string str)
{
cond = str;
}
void setCondition(string str)
{
cond = str;
}
string getCondition()
{
return cond;
}
}
public:
Condition(string str)
{
cond = str;
}
void setCondition(string str)
{
cond = str;
}
string getCondition()
{
return cond;
}
};
class Selection()
class Selection
{
string select;
Selection(string str)
{
select = str;
}
string getSelection()
{
return select;
}
}
class expr
{
Relation r;
selection
projection
renaming
Union
difference
product
}
public:
Selection(string str)
{
select = str;
}
string getSelection()
{
return select;
}
};