-// $Id: CQLNode.java,v 1.21 2002-12-12 10:24:25 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;
/**
* Represents a node in a CQL parse-tree.
*
- * @version $Id: CQLNode.java,v 1.21 2002-12-12 10:24:25 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
* else, then null is returned instead.
* @return the name of the referenced result-set
*/
- public String getResultSetName() { return null; }
+ public String getResultSetName() {
+ return null;
+ }
/**
* Translates a parse-tree into an XCQL document.
* parse-tree whose root is this node.
*/
public String toXCQL(int level) {
- return toXCQL(level, new Vector());
+ return toXCQL(level, null);
+ }
+
+ public String toXCQL(int level, Vector<CQLPrefix> prefixes) {
+ return toXCQL(level, prefixes, null);
}
- abstract public String toXCQL(int level, Vector prefixes);
+ abstract public String toXCQL(int level, Vector<CQLPrefix> prefixes,
+ Vector<ModifierSet> sortkeys);
protected static String renderPrefixes(int level, Vector prefixes) {
- if (prefixes.size() == 0)
+ if (prefixes == null || prefixes.size() == 0)
return "";
String res = indent(level) + "<prefixes>\n";
for (int i = 0; i < prefixes.size(); i++) {
return res + indent(level) + "</prefixes>\n";
}
+ protected static String renderSortKeys(int level,
+ Vector<ModifierSet> sortkeys) {
+ if (sortkeys == null || sortkeys.size() == 0)
+ return "";
+ String res = indent(level) + "<sortKeys>\n";
+ for (int i = 0; i < sortkeys.size(); i++) {
+ ModifierSet key = sortkeys.get(i);
+ res += key.sortKeyToXCQL(level+1);
+ }
+ return res + indent(level) + "</sortKeys>\n";
+ }
+
/**
* Decompiles a parse-tree into a CQL query.
* <P>
* <P>
* @param config
* A <TT>Properties</TT> 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,
*
* @param config
* A <TT>Properties</TT> 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,
/**
* 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?
/**
* 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) {
}
// Used only by the makeOID() method
- private static final java.util.Hashtable madeOIDs =
- new java.util.Hashtable(10);
+ private static final java.util.Hashtable<String, byte[]> madeOIDs =
+ new java.util.Hashtable<String, byte[]>(10);
protected static final byte[] makeOID(String oid) {
byte[] o;