X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLPrefixNode.java;h=aae60388b9c6a6a1207649b070db11b8ea27a2c8;hb=f57d48d060411f662eea823b97cc45038bda0def;hp=604ef5f69699fc1974a4317eb90855961f0905e4;hpb=08be5e2bc983dc2537b3efae7e4336322c297a0c;p=cql-java-moved-to-github.git
diff --git a/src/org/z3950/zing/cql/CQLPrefixNode.java b/src/org/z3950/zing/cql/CQLPrefixNode.java
index 604ef5f..aae6038 100644
--- a/src/org/z3950/zing/cql/CQLPrefixNode.java
+++ b/src/org/z3950/zing/cql/CQLPrefixNode.java
@@ -1,14 +1,15 @@
-// $Id: CQLPrefixNode.java,v 1.2 2002-11-14 22:07:32 mike Exp $
+// $Id: CQLPrefixNode.java,v 1.9 2007-07-03 13:40:41 mike Exp $
package org.z3950.zing.cql;
import java.lang.String;
import java.util.Properties;
+import java.util.Vector;
/**
* Represents a prefix node in a CQL parse-tree.
*
- * @version $Id: CQLPrefixNode.java,v 1.2 2002-11-14 22:07:32 mike Exp $
+ * @version $Id: CQLPrefixNode.java,v 1.9 2007-07-03 13:40:41 mike Exp $
*/
public class CQLPrefixNode extends CQLNode {
/**
@@ -24,7 +25,7 @@ public class CQLPrefixNode extends CQLNode {
/**
* Creates a new CQLPrefixNode inducing a mapping from the
- * specified qualifier-set name to the specified identifier across
+ * specified index-set name to the specified identifier across
* the specified subtree.
*/
public CQLPrefixNode(String name, String identifier, CQLNode subtree) {
@@ -32,29 +33,39 @@ public class CQLPrefixNode extends CQLNode {
this.subtree = subtree;
}
- public String toXCQL(int level) {
- String maybeName = "";
- if (prefix.name != null)
- maybeName = indent(level+1) + "" + prefix.name + "\n";
+ public String toXCQL(int level, Vector prefixes,
+ Vector sortkeys) {
+ if (sortkeys != null)
+ throw new Error("CQLPrefixNode.toXCQL() called with sortkeys");
- return (indent(level) + "\n" + maybeName +
- indent(level+1) +
- "" + prefix.identifier + "\n" +
- subtree.toXCQL(level+1) +
- indent(level) + "\n");
+ Vector tmp = (prefixes == null ?
+ new Vector() :
+ new Vector(prefixes));
+ tmp.add(prefix);
+ return subtree.toXCQL(level, tmp);
}
public String toCQL() {
- // ### We don't always need parens around the operand
- return ">" + prefix.name + "=\"" + prefix.identifier + "\" " +
- "(" + subtree.toCQL() + ")";
+ // ### We don't always need parens around the subtree
+ if (prefix.name == null) {
+ return ">\"" + prefix.identifier + "\" " +
+ "(" + subtree.toCQL() + ")";
+ } else {
+ return ">" + prefix.name + "=\"" + prefix.identifier + "\" " +
+ "(" + subtree.toCQL() + ")";
+ }
}
public String toPQF(Properties config) throws PQFTranslationException {
// Prefixes and their identifiers don't actually play any role
- // in PQF translation, since the meanings of the qualifiers,
+ // in PQF translation, since the meanings of the indexes,
// including their prefixes if any, are instead wired into
// `config'.
return subtree.toPQF(config);
}
+
+ public byte[] toType1BER(Properties config) throws PQFTranslationException {
+ // See comment on toPQF()
+ return subtree.toType1BER(config);
+ }
}