Latest changes
git-svn-id: svn://10.0.0.236/trunk@30777 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -4,4 +4,30 @@ class RelationalNode extends BinaryNode {
|
||||
{
|
||||
super(aOp, aLeft, aRight);
|
||||
}
|
||||
|
||||
void eval(Environment theEnv)
|
||||
{
|
||||
super.eval(theEnv);
|
||||
double dR = theEnv.theStack.pop().d;
|
||||
double dL = theEnv.theStack.pop().d;
|
||||
if (op == ">")
|
||||
theEnv.theStack.push(new StackValue((dL > dR) ? 1 : 0));
|
||||
else
|
||||
if (op == ">=")
|
||||
theEnv.theStack.push(new StackValue((dL >= dR) ? 1 : 0));
|
||||
else
|
||||
if (op == "<")
|
||||
theEnv.theStack.push(new StackValue((dL < dR) ? 1 : 0));
|
||||
else
|
||||
if (op == "<=")
|
||||
theEnv.theStack.push(new StackValue((dL <= dR) ? 1 : 0));
|
||||
else
|
||||
if (op == "==")
|
||||
theEnv.theStack.push(new StackValue((dL == dR) ? 1 : 0));
|
||||
else
|
||||
if (op == "!=")
|
||||
theEnv.theStack.push(new StackValue((dL != dR) ? 1 : 0));
|
||||
else
|
||||
System.out.println("missing relational op");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user