From 0f1055b8d7f97d86c66fa602c17666bc2ff9c437 Mon Sep 17 00:00:00 2001 From: Constantin Jucovschi Date: Tue, 31 Mar 2009 06:18:54 -0400 Subject: Initial commit --- src/grammar/BooleanScalarExpr.java | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/grammar/BooleanScalarExpr.java (limited to 'src/grammar/BooleanScalarExpr.java') diff --git a/src/grammar/BooleanScalarExpr.java b/src/grammar/BooleanScalarExpr.java new file mode 100644 index 0000000..1123eda --- /dev/null +++ b/src/grammar/BooleanScalarExpr.java @@ -0,0 +1,74 @@ +package grammar; + +/** + * BooleanScalarExpr + * Creation date: (3/3/2003 2:28:43 AM) + * @author: mattia parigiani, Sorin Stancu-Mara, Andrei Aiordachioaie + */ + +public class BooleanScalarExpr implements IParseTreeNode +{ + BooleanScalarExpr leftBooleanScalarExpr, rightBooleanScalarExpr; + NumericScalarExpr leftNumericScalar, rightNumericScalar; + IParseTreeNode left, right; + String booleanConstant; + String op; + String node1, node2; + + public BooleanScalarExpr(String bc) { + op = null; + booleanConstant = bc; + } + + public BooleanScalarExpr(String op, BooleanScalarExpr be){ + this.op = op; + left = be ; + } + + public BooleanScalarExpr(String op, BooleanScalarExpr lbe, BooleanScalarExpr rbe){ + this.op = op; + left = lbe ; + right = rbe ; + } + + public BooleanScalarExpr(String op, NumericScalarExpr left, NumericScalarExpr right) + { + this.op = op; + this.left = left; + this.right = right; + } + + public BooleanScalarExpr(String op, StringScalarExpr e1, StringScalarExpr e2) + { + this.op = op; + left = e1; + right = e2; + } + + public String toXML(){ + if (op == null) return "" + booleanConstant + ""; + else if (op.equals("not")) return "" + left.toXML() + ""; + else + { + if (this.left != null) + node1 = this.left.toXML(); + if (this.right != null) + node2 = this.right.toXML(); + + if (op.equals("and")) op = "booleanAnd"; + else if (op.equals("or")) op = "booleanOr"; + else if (op.equals("xor")) op = "booleanXor"; + + else if (op.equals("=")) op = "booleanEqualNumeric"; + else if (op.equals("!=")) op = "booleanNotEqualNumeric"; + else if (op.equals("<")) op = "booleanLessThan"; + else if (op.equals(">")) op = "booleanGreaterThan"; + else if (op.equals("<=")) op = "booleanLessOrEqual"; + else if (op.equals(">=")) op = "booleanGreaterOrEqual"; + + return "<" + op + ">" + node1 + node2 + ""; + } + + } + +} -- cgit