toXCQL() renders sort-keys, if any.
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLBooleanNode.java
index c449ce9..ec0608c 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: CQLBooleanNode.java,v 1.15 2007-06-29 10:21:30 mike Exp $
+// $Id: CQLBooleanNode.java,v 1.18 2007-07-03 16:03:00 mike Exp $
 
 package org.z3950.zing.cql;
 import java.util.Properties;
@@ -8,7 +8,7 @@ import java.util.Vector;
 /**
  * Represents a boolean node in a CQL parse-tree.
  *
- * @version    $Id: CQLBooleanNode.java,v 1.15 2007-06-29 10:21:30 mike Exp $
+ * @version    $Id: CQLBooleanNode.java,v 1.18 2007-07-03 16:03:00 mike Exp $
  */
 public abstract class CQLBooleanNode extends CQLNode {
     /**
@@ -32,8 +32,8 @@ public abstract class CQLBooleanNode extends CQLNode {
        this.ms = ms;
     }
 
-    public String toXCQL(int level, Vector prefixes) {
-       // ### Should this use CQLNode.toXCQL(level+2, prefixes)?
+    public String toXCQL(int level, Vector<CQLPrefix> prefixes,
+                        Vector<ModifierSet> sortkeys) {
        return (indent(level) + "<triple>\n" +
                renderPrefixes(level+1, prefixes) +
                ms.toXCQL(level+1, "boolean") +
@@ -43,12 +43,15 @@ public abstract class CQLBooleanNode extends CQLNode {
                indent(level+1) + "<rightOperand>\n" +
                right.toXCQL(level+2) +
                indent(level+1) + "</rightOperand>\n" +
+               renderSortKeys(level+1, sortkeys) +
                indent(level) + "</triple>\n");
     }
 
     public String toCQL() {
        // ### We don't always need parens around the operands
-       return "(" + left.toCQL() + ") " + op() + " (" + right.toCQL() + ")";
+       return ("(" + left.toCQL() + ")" +
+               " " + ms.toCQL() + " " +
+               "(" + right.toCQL() + ")");
     }
 
     public String toPQF(Properties config) throws PQFTranslationException {
@@ -58,9 +61,7 @@ public abstract class CQLBooleanNode extends CQLNode {
     }
 
     // represents the operation for PQF: overridden for CQLProxNode
-    String opPQF() { return op(); }
-
-    abstract String op();
+    String opPQF() { return ms.getBase(); }
 
     public byte[] toType1BER(Properties config) throws PQFTranslationException {
         System.out.println("in CQLBooleanNode.toType1BER(): PQF=" +