X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLBooleanNode.java;h=b0ca761d8d0414df3c5bc2101d049874ba83a79c;hb=77e96a476683020357b2c6e6fa661024698a20d8;hp=9908395ada666d023322bcad48d2aa3b2630fc54;hpb=953117d805ff5f53b2b3c541eff5ecd6461eba29;p=cql-java-moved-to-github.git
diff --git a/src/org/z3950/zing/cql/CQLBooleanNode.java b/src/org/z3950/zing/cql/CQLBooleanNode.java
index 9908395..b0ca761 100644
--- a/src/org/z3950/zing/cql/CQLBooleanNode.java
+++ b/src/org/z3950/zing/cql/CQLBooleanNode.java
@@ -1,29 +1,55 @@
-// $Id: CQLBooleanNode.java,v 1.3 2002-10-25 16:56:43 mike Exp $
+// $Id: CQLBooleanNode.java,v 1.8 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
+import java.util.Properties;
/**
- * Represents a boolean node in a CQL parse-tree ...
- * ###
+ * Represents a boolean node in a CQL parse-tree.
*
- * @version $Id: CQLBooleanNode.java,v 1.3 2002-10-25 16:56:43 mike Exp $
+ * @version $Id: CQLBooleanNode.java,v 1.8 2002-11-06 20:13:45 mike Exp $
*/
public abstract class CQLBooleanNode extends CQLNode {
- protected CQLNode left;
- protected CQLNode right;
+ CQLBooleanNode() {} // prevent javadoc from documenting this
- abstract String op();
+ /**
+ * The root of a parse-tree representing the left-hand side.
+ */
+ public CQLNode left;
+
+ /**
+ * The root of a parse-tree representing the right-hand side.
+ */
+ public CQLNode right;
- String toXCQL(int level) {
- return(indent(level) + "\n" +
- indent(level+1) + "" + op() + "\n" +
- left.toXCQL(level+1) +
- right.toXCQL(level+1) +
- indent(level) + "\n");
+ public String toXCQL(int level) {
+ return (indent(level) + "\n" +
+ opXQL(level+1) +
+ left.toXCQL(level+1) +
+ right.toXCQL(level+1) +
+ indent(level) + "\n");
}
- String toCQL() {
+ // Represents the boolean operation itself: overridden for CQLProxNode
+ String opXQL(int level) {
+ return(indent(level) + "\n" +
+ indent(level+1) + "" + op() + "\n" +
+ indent(level) + "\n");
+ }
+
+ public String toCQL() {
+ // ### We don't always need parens around the operands
return "(" + left.toCQL() + ") " + op() + " (" + right.toCQL() + ")";
}
+
+ public String toPQF(Properties config) throws PQFTranslationException {
+ return ("@" + opPQF() +
+ " " + left.toPQF(config) +
+ " " + right.toPQF(config));
+ }
+
+ // represents the operation for PQF: overridden for CQLProxNode
+ String opPQF() { return op(); }
+
+ abstract String op();
}