mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 00:55:37 +00:00
43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
class BinaryNode extends ExpressionNode {
|
|
|
|
BinaryNode(String aOp, ExpressionNode aLeft, ExpressionNode aRight)
|
|
{
|
|
left = aLeft;
|
|
right = aRight;
|
|
op = aOp;
|
|
}
|
|
|
|
void eval(Environment theEnv)
|
|
{
|
|
left.eval(theEnv);
|
|
right.eval(theEnv);
|
|
}
|
|
|
|
String print(String indent)
|
|
{
|
|
StringBuffer result = new StringBuffer(indent);
|
|
result.append(getClass().toString());
|
|
result.append(" ");
|
|
result.append(op);
|
|
result.append("\n");
|
|
indent += " ";
|
|
if (left == null) {
|
|
result.append(indent);
|
|
result.append("null\n");
|
|
}
|
|
else
|
|
result.append(left.print(indent));
|
|
if (right == null) {
|
|
result.append(indent);
|
|
result.append("null\n");
|
|
}
|
|
else
|
|
result.append(right.print(indent));
|
|
return result.toString();
|
|
}
|
|
|
|
protected ExpressionNode left;
|
|
protected ExpressionNode right;
|
|
protected String op;
|
|
|
|
} |