X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLNode.java;h=3e42e1e101bf35163cf343b4eb721b2cc2999399;hb=af9fc1ccd0a8d9048d0b469a72b11bead020b719;hp=45734001f3319595261c60e4fe4614afb8daf37e;hpb=e4126f4c547f5f823fbfceb4169786bc7cf98401;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLNode.java b/src/org/z3950/zing/cql/CQLNode.java index 4573400..3e42e1e 100644 --- a/src/org/z3950/zing/cql/CQLNode.java +++ b/src/org/z3950/zing/cql/CQLNode.java @@ -1,4 +1,4 @@ -// $Id: CQLNode.java,v 1.23 2007-06-06 12:22:01 mike Exp $ +// $Id: CQLNode.java,v 1.26 2007-07-03 13:36:03 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -8,7 +8,7 @@ import java.util.Vector; /** * Represents a node in a CQL parse-tree. * - * @version $Id: CQLNode.java,v 1.23 2007-06-06 12:22:01 mike Exp $ + * @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 @@ -38,13 +38,18 @@ public abstract class CQLNode { * parse-tree whose root is this node. */ public String toXCQL(int level) { - return toXCQL(level, new Vector()); + return toXCQL(level, null); } - abstract public String toXCQL(int level, Vector prefixes); + public String toXCQL(int level, Vector prefixes) { + return toXCQL(level, prefixes, null); + } + + abstract public String toXCQL(int level, Vector prefixes, + Vector sortkeys); protected static String renderPrefixes(int level, Vector prefixes) { - if (prefixes.size() == 0) + if (prefixes == null || prefixes.size() == 0) return ""; String res = indent(level) + "\n"; for (int i = 0; i < prefixes.size(); i++) { @@ -59,6 +64,18 @@ public abstract class CQLNode { return res + indent(level) + "\n"; } + protected static String renderSortKeys(int level, + Vector sortkeys) { + if (sortkeys == null || sortkeys.size() == 0) + return ""; + String res = indent(level) + "\n"; + for (int i = 0; i < sortkeys.size(); i++) { + ModifierSet key = sortkeys.get(i); + res += key.sortKeyToXCQL(level+1); + } + return res + indent(level) + "\n"; + } + /** * Decompiles a parse-tree into a CQL query. *

@@ -81,7 +98,7 @@ public abstract class CQLNode { *

* @param config * A Properties object containing configuration - * information that specifies the mapping from CQL qualifiers, + * information that specifies the mapping from CQL indexes, * relations, etc. to Type-1 attributes. The mapping * specification is described in the CQL-Java distribution's * sample PQF-mapping configuration file, @@ -113,7 +130,7 @@ public abstract class CQLNode { * * @param config * A Properties object containing configuration - * information that specifies the mapping from CQL qualifiers, + * information that specifies the mapping from CQL indexes, * relations, etc. to Type-1 attributes. The mapping * specification is described in the CQL-Java distribution's * sample PQF-mapping configuration file, @@ -171,7 +188,7 @@ public abstract class CQLNode { /** * Put a length directly into a BER record. * - * @param length length to put into record + * @param len length to put into record * @return the new, incremented value of the offset parameter. */ public // ### shouldn't this be protected? @@ -210,7 +227,7 @@ public abstract class CQLNode { /** * Get the length needed to represent the given number. * - * @param number determine length needed to encode this + * @param num determine length needed to encode this * @return length needed to encode given number */ protected static final int numLen(long num) {