X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLTermNode.java;h=cdb62f75019162af10556e91205d4fcf7ddbef8a;hb=7cff92fa0b727aa844456f130744ec2fe263ba48;hp=924b6baa8de28820290612d44b06aa96be666a5e;hpb=54f3ed06b35c7f352909cf159432e961ca38c264;p=cql-java-moved-to-github.git diff --git a/src/main/java/org/z3950/zing/cql/CQLTermNode.java b/src/main/java/org/z3950/zing/cql/CQLTermNode.java index 924b6ba..cdb62f7 100644 --- a/src/main/java/org/z3950/zing/cql/CQLTermNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLTermNode.java @@ -1,8 +1,11 @@ // $Id: CQLTermNode.java,v 1.28 2007-07-03 13:41:24 mike Exp $ package org.z3950.zing.cql; +import java.util.ArrayList; +import java.util.List; import java.util.Properties; -import java.util.Vector; + +import static org.z3950.zing.cql.Utils.*; /** @@ -51,8 +54,9 @@ public class CQLTermNode extends CQLNode { return null; } - public String toXCQL(int level, Vector prefixes, - Vector sortkeys) { + @Override + public String toXCQL(int level, List prefixes, + List sortkeys) { return (indent(level) + "\n" + renderPrefixes(level+1, prefixes) + indent(level+1) + "" + xq(index) + "\n" + @@ -62,6 +66,7 @@ public class CQLTermNode extends CQLNode { indent(level) + "\n"); } + @Override public String toCQL() { String quotedIndex = maybeQuote(index); String quotedTerm = maybeQuote(term); @@ -80,8 +85,8 @@ public class CQLTermNode extends CQLNode { // ### Interaction between this and its callers is not good as // regards truncation of the term and generation of truncation // attributes. Change the interface to fix this. - private Vector getAttrs(Properties config) throws PQFTranslationException { - Vector attrs = new Vector(); + private List getAttrs(Properties config) throws PQFTranslationException { + List attrs = new ArrayList(); // Do this first so that if any other truncation or // completeness attributes are generated, they "overwrite" @@ -118,7 +123,7 @@ public class CQLTermNode extends CQLNode { throw new UnknownRelationException(rel); attrs.add(attr); - Vector mods = relation.getModifiers(); + List mods = relation.getModifiers(); for (int i = 0; i < mods.size(); i++) { String type = mods.get(i).type; attr = config.getProperty("relationModifier." + type); @@ -157,6 +162,7 @@ public class CQLTermNode extends CQLNode { return attrs; } + @Override public String toPQF(Properties config) throws PQFTranslationException { if (isResultSetIndex(index)) { // Special case: ignore relation, modifiers, wildcards, etc. @@ -164,12 +170,12 @@ public class CQLTermNode extends CQLNode { return "@set " + maybeQuote(term); } - Vector attrs = getAttrs(config); + List attrs = getAttrs(config); String attr, s = ""; for (int i = 0; i < attrs.size(); i++) { attr = (String) attrs.get(i); - s += "@attr " + Utils.replaceString(attr, " ", " @attr ") + " "; + s += "@attr " + attr.replace(" ", " @attr ") + " "; } String text = term; @@ -197,12 +203,13 @@ public class CQLTermNode extends CQLNode { str.indexOf('/') != -1 || str.indexOf('(') != -1 || str.indexOf(')') != -1) { - str = '"' + Utils.replaceString(str, "\"", "\\\"") + '"'; + str = '"' + str.replace("\"", "\\\"") + '"'; } return str; } + @Override public byte[] toType1BER(Properties config) throws PQFTranslationException { if (isResultSetIndex(index)) { // Special case: ignore relation, modifiers, wildcards, etc. @@ -240,7 +247,7 @@ public class CQLTermNode extends CQLNode { offset = putTag(CONTEXT, 44, CONSTRUCTED, operand, offset); // AttributeList operand[offset++] = (byte)(0x80&0xff); // indefinite length - Vector attrs = getAttrs(config); + List attrs = getAttrs(config); for(i = 0; i < attrs.size(); i++) { attrList = (String) attrs.get(i); java.util.StringTokenizer st =