X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLNode.java;h=88b50ca0783aacfdfbf8f53172d73fca37dcb763;hb=7cff92fa0b727aa844456f130744ec2fe263ba48;hp=3e42e1e101bf35163cf343b4eb721b2cc2999399;hpb=d58739419882639439b40b18fcefeb9e51488fb9;p=cql-java-moved-to-github.git diff --git a/src/main/java/org/z3950/zing/cql/CQLNode.java b/src/main/java/org/z3950/zing/cql/CQLNode.java index 3e42e1e..88b50ca 100644 --- a/src/main/java/org/z3950/zing/cql/CQLNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLNode.java @@ -1,8 +1,12 @@ // $Id: CQLNode.java,v 1.26 2007-07-03 13:36:03 mike Exp $ package org.z3950.zing.cql; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Properties; -import java.util.Vector; + +import static org.z3950.zing.cql.Utils.*; /** @@ -41,19 +45,19 @@ public abstract class CQLNode { return toXCQL(level, null); } - public String toXCQL(int level, Vector prefixes) { + public String toXCQL(int level, List prefixes) { return toXCQL(level, prefixes, null); } - abstract public String toXCQL(int level, Vector prefixes, - Vector sortkeys); + abstract public String toXCQL(int level, List prefixes, + List sortkeys); - protected static String renderPrefixes(int level, Vector prefixes) { + protected static String renderPrefixes(int level, List prefixes) { if (prefixes == null || prefixes.size() == 0) return ""; String res = indent(level) + "\n"; for (int i = 0; i < prefixes.size(); i++) { - CQLPrefix p = (CQLPrefix) prefixes.get(i); + CQLPrefix p = prefixes.get(i); res += indent(level+1) + "\n"; if (p.name != null) res += indent(level+2) + "" + p.name + "\n"; @@ -65,7 +69,7 @@ public abstract class CQLNode { } protected static String renderSortKeys(int level, - Vector sortkeys) { + List sortkeys) { if (sortkeys == null || sortkeys.size() == 0) return ""; String res = indent(level) + "\n"; @@ -111,18 +115,6 @@ public abstract class CQLNode { throws PQFTranslationException; /** - * Returns a String of spaces for indenting to the specified level. - */ - protected static String indent(int level) { return Utils.indent(level); } - - /** - * Returns the argument String quoted for XML. - * For example, each occurrence of < is translated to - * &lt;. - */ - protected static String xq(String str) { return Utils.xq(str); } - - /** * Renders a parser-tree into a BER-endoded packet representing an * equivalent Z39.50 Type-1 query. If you don't know what that * means, then you don't need this method :-) This is useful @@ -191,8 +183,7 @@ public abstract class CQLNode { * @param len length to put into record * @return the new, incremented value of the offset parameter. */ - public // ### shouldn't this be protected? - static final int putLen(int len, byte[] record, int offset) { + static final int putLen(int len, byte[] record, int offset) { if (len < 128) record[offset++] = (byte)len; @@ -262,8 +253,8 @@ public abstract class CQLNode { } // Used only by the makeOID() method - private static final java.util.Hashtable madeOIDs = - new java.util.Hashtable(10); + private static final Map madeOIDs = + new HashMap(10); protected static final byte[] makeOID(String oid) { byte[] o;