// $Id: CQLBooleanNode.java,v 1.18 2007-07-03 16:03:00 mike Exp $
package org.z3950.zing.cql;
+import java.util.List;
import java.util.Properties;
-import java.util.Vector;
/**
/**
* The set of modifiers that are applied to this boolean.
*/
- public Vector<Modifier> getModifiers() {
+ public List<Modifier> getModifiers() {
return ms.getModifiers();
}
this.ms = ms;
}
- public String toXCQL(int level, Vector<CQLPrefix> prefixes,
- Vector<ModifierSet> sortkeys) {
+ public String toXCQL(int level, List<CQLPrefix> prefixes,
+ List<ModifierSet> sortkeys) {
return (indent(level) + "<triple>\n" +
renderPrefixes(level+1, prefixes) +
ms.toXCQL(level+1, "boolean") +
package org.z3950.zing.cql;
import java.io.StreamTokenizer;
import java.io.StringReader;
-import java.util.Hashtable;
// This is a semi-trivial subclass for java.io.StreamTokenizer that:
// $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;
/**
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";
}
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";
}
// 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;
// $Id: CQLParseException.java,v 1.2 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
package org.z3950.zing.cql;
import java.io.IOException;
-import java.util.Vector;
import java.util.Properties;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
/**
char mode = 'x'; // x=XCQL, c=CQL, p=PQF
String pfile = null;
- Vector<String> argv = new Vector<String>();
+ List<String> argv = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
argv.add(args[i]);
}
// $Id: CQLPrefix.java,v 1.5 2007-06-27 22:39:55 mike Exp $
package org.z3950.zing.cql;
-import java.lang.String;
/**
* Represents a CQL prefix mapping from short name to long identifier.
// $Id: CQLPrefixNode.java,v 1.10 2007-07-03 16:40:11 mike Exp $
package org.z3950.zing.cql;
-import java.lang.String;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
-import java.util.Vector;
/**
this.subtree = subtree;
}
- public String toXCQL(int level, Vector<CQLPrefix> prefixes,
- Vector<ModifierSet> sortkeys) {
- Vector<CQLPrefix> tmp = (prefixes == null ?
- new Vector<CQLPrefix>() :
- new Vector<CQLPrefix>(prefixes));
+ public String toXCQL(int level, List<CQLPrefix> prefixes,
+ List<ModifierSet> sortkeys) {
+ List<CQLPrefix> tmp = (prefixes == null ?
+ new ArrayList<CQLPrefix>() :
+ new ArrayList<CQLPrefix>(prefixes));
tmp.add(prefix);
return subtree.toXCQL(level, tmp, sortkeys);
}
// $Id: CQLRelation.java,v 1.19 2007-07-03 13:40:58 mike Exp $
package org.z3950.zing.cql;
-import java.util.Vector;
+import java.util.List;
import java.util.Properties;
-import java.lang.StringBuffer;
/**
* Represents a relation between a CQL index and term.
* @return
* An array of Modifier objects.
*/
- public Vector<Modifier> getModifiers() {
+ public List<Modifier> getModifiers() {
return ms.getModifiers();
}
- public String toXCQL(int level, Vector prefixes, Vector sortkeys) {
+ public String toXCQL(int level, List<CQLPrefix> prefixes,
+ List<ModifierSet> sortkeys) {
if (sortkeys != null)
throw new Error("CQLRelation.toXCQL() called with sortkeys");
// $Id: CQLSortNode.java,v 1.2 2008-04-11 12:05:15 mike Exp $
package org.z3950.zing.cql;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
-import java.util.Vector;
/**
* each expressed as an index together with zero or more
* modifiers.
*/
- Vector<ModifierSet> keys;
+ List<ModifierSet> keys;
public CQLNode getSubtree() {
return subtree;
public CQLSortNode(CQLNode subtree) {
this.subtree = subtree;
- keys = new Vector<ModifierSet>();
+ keys = new ArrayList<ModifierSet>();
}
public void addSortIndex(ModifierSet key) {
keys.add(key);
}
- public Vector<ModifierSet> getSortIndexes() {
+ public List<ModifierSet> getSortIndexes() {
return keys;
}
- public String toXCQL(int level, Vector<CQLPrefix> prefixes,
- Vector<ModifierSet> sortkeys) {
+ public String toXCQL(int level, List<CQLPrefix> prefixes,
+ List<ModifierSet> sortkeys) {
if (sortkeys != null)
throw new Error("CQLSortNode.toXCQL() called with sortkeys");
return subtree.toXCQL(level, prefixes, keys);
// $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;
/**
return null;
}
- public String toXCQL(int level, Vector<CQLPrefix> prefixes,
- Vector<ModifierSet> sortkeys) {
+ public String toXCQL(int level, List<CQLPrefix> prefixes,
+ List<ModifierSet> sortkeys) {
return (indent(level) + "<searchClause>\n" +
renderPrefixes(level+1, prefixes) +
indent(level+1) + "<index>" + xq(index) + "</index>\n" +
// ### 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<String> attrs = new Vector<String>();
+ private List<String> getAttrs(Properties config) throws PQFTranslationException {
+ List<String> attrs = new ArrayList<String>();
// Do this first so that if any other truncation or
// completeness attributes are generated, they "overwrite"
throw new UnknownRelationException(rel);
attrs.add(attr);
- Vector<Modifier> mods = relation.getModifiers();
+ List<Modifier> mods = relation.getModifiers();
for (int i = 0; i < mods.size(); i++) {
String type = mods.get(i).type;
attr = config.getProperty("relationModifier." + type);
return "@set " + maybeQuote(term);
}
- Vector attrs = getAttrs(config);
+ List<String> attrs = getAttrs(config);
String attr, s = "";
for (int i = 0; i < attrs.size(); i++) {
offset = putTag(CONTEXT, 44, CONSTRUCTED, operand, offset); // AttributeList
operand[offset++] = (byte)(0x80&0xff); // indefinite length
- Vector attrs = getAttrs(config);
+ List<String> attrs = getAttrs(config);
for(i = 0; i < attrs.size(); i++) {
attrList = (String) attrs.get(i);
java.util.StringTokenizer st =
// $Id: MissingParameterException.java,v 1.2 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
// $Id: Modifier.java,v 1.4 2007-07-03 13:29:34 mike Exp $
package org.z3950.zing.cql;
-import java.util.Vector;
import java.lang.StringBuffer;
/**
// $Id: ModifierSet.java,v 1.13 2007-07-03 13:30:18 mike Exp $
package org.z3950.zing.cql;
-import java.util.Vector;
import java.lang.StringBuffer;
+import java.util.ArrayList;
+import java.util.List;
/**
* Represents a base String and a set of Modifiers.
*/
public class ModifierSet {
private String base;
- private Vector<Modifier> modifiers;
+ private List<Modifier> modifiers;
/**
* Creates a new ModifierSet with the specified base.
*/
public ModifierSet(String base) {
this.base = base;
- modifiers = new Vector<Modifier>();
+ modifiers = new ArrayList<Modifier>();
}
/**
* @return
* An array of Modifiers.
*/
- public Vector<Modifier> getModifiers() {
+ public List<Modifier> getModifiers() {
return modifiers;
}
// $Id: PQFTranslationException.java,v 1.1 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
// $Id: UnknownIndexException.java,v 1.2 2007-06-27 22:44:40 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
// $Id: UnknownPositionException.java,v 1.2 2002-11-29 16:42:54 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
// $Id: UnknownRelationException.java,v 1.2 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**
// $Id: UnknownRelationModifierException.java,v 1.1 2002-11-06 20:13:45 mike Exp $
package org.z3950.zing.cql;
-import java.lang.Exception;
/**