gecko-dev/js/js2/java/BinaryNode.java
rogerl%netscape.com 8cf3d6ffe7 Latest changes
1999-05-07 22:07:22 +00:00

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;
}