Import statics directly, bump version
[cql-java-moved-to-github.git] / src / main / java / org / z3950 / zing / cql / CQLNode.java
index 3e42e1e..88b50ca 100644 (file)
@@ -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<CQLPrefix> prefixes) {
+    public String toXCQL(int level, List<CQLPrefix> prefixes) {
        return toXCQL(level, prefixes, null);
     }
 
-    abstract public String toXCQL(int level, Vector<CQLPrefix> prefixes,
-                                 Vector<ModifierSet> sortkeys);
+    abstract public String toXCQL(int level, List<CQLPrefix> prefixes,
+                                 List<ModifierSet> sortkeys);
 
-    protected static String renderPrefixes(int level, Vector prefixes) {
+    protected static String renderPrefixes(int level, List<CQLPrefix> prefixes) {
        if (prefixes == null || prefixes.size() == 0)
            return "";
        String res = indent(level) + "<prefixes>\n";
        for (int i = 0; i < prefixes.size(); i++) {
-           CQLPrefix p = (CQLPrefix) prefixes.get(i);
+           CQLPrefix p = prefixes.get(i);
            res += indent(level+1) + "<prefix>\n";
            if (p.name != null)
                res += indent(level+2) + "<name>" + p.name + "</name>\n";
@@ -65,7 +69,7 @@ public abstract class CQLNode {
     }
 
     protected static String renderSortKeys(int level,
-                                          Vector<ModifierSet> sortkeys) {
+                                          List<ModifierSet> sortkeys) {
        if (sortkeys == null || sortkeys.size() == 0)
            return "";
        String res = indent(level) + "<sortKeys>\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 <TT>&lt;</TT> is translated to
-     * <TT>&amp;lt;</TT>.
-     */
-    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<String, byte[]> madeOIDs =
-       new java.util.Hashtable<String, byte[]>(10);
+    private static final Map<String, byte[]> madeOIDs =
+       new HashMap<String, byte[]>(10);
 
     protected static final byte[] makeOID(String oid) {
         byte[] o;