Allow a list of quoted terms
[cql-java-moved-to-github.git] / src / main / java / org / z3950 / zing / cql / CQLNode.java
index afaa892..a4e171d 100644 (file)
@@ -1,4 +1,3 @@
-// $Id: CQLNode.java,v 1.26 2007-07-03 13:36:03 mike Exp $
 
 package org.z3950.zing.cql;
 import java.util.HashMap;
@@ -11,10 +10,8 @@ import java.util.Properties;
 /**
  * Represents a node in a CQL parse-tree.
  *
- * @version    $Id: CQLNode.java,v 1.26 2007-07-03 13:36:03 mike Exp $
  */
 public abstract class CQLNode {
-    CQLNode() {}               // prevent javadoc from documenting this
 
     /**
      * Returns the name of the result-set to which this query is a
@@ -31,11 +28,6 @@ public abstract class CQLNode {
     /**
      * Translates a parse-tree into an XCQL document.
      * <P>
-     * @param level
-     * The number of levels to indent the top element of the XCQL
-     * document.  This will typically be 0 when invoked by an
-     * application; it takes higher values when this method is
-     * invoked recursively for nodes further down the tree.
      * @return
      * A String containing an XCQL document equivalent to the
      * parse-tree whose root is this node.
@@ -64,9 +56,9 @@ public abstract class CQLNode {
            if (p.name != null)
                b.indent(level + 2).append("<name>").
                     append(p.name).append("</name>\n");
-           b.indent(level + 2).append("<identifier>").append(p.identifier).
-              append("</identifier>\n");
-           b.indent(level+1).append("</prefix>\n");
+            b.indent(level + 2).append("<identifier>").
+                append(p.identifier).append("</identifier>\n");
+            b.indent(level+1).append("</prefix>\n");
        }
        b.indent(level).append("</prefixes>\n");
     }
@@ -78,7 +70,7 @@ public abstract class CQLNode {
        b.indent(level).append("<sortKeys>\n");
        for (int i = 0; i < sortkeys.size(); i++) {
            ModifierSet key = sortkeys.get(i);
-           b.append(key.sortKeyToXCQL(level+1));
+           key.toXCQLInternal(b, level+1, "key", "index");
        }
        b.indent(level).append("</sortKeys>\n");
     }
@@ -345,4 +337,9 @@ public abstract class CQLNode {
         System.arraycopy(qry, 0, q, 0, offset);
         return q;
     }
+    
+    @Override
+    public String toString() {
+        return toCQL();
+    }
 }