X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLRelation.java;h=cb2dfb649b7dbbaaee4f6aa0ee7e957d32aee48f;hb=f3c88fe15ee06a671407a0368e449db991526802;hp=ff8db8f48c04eec4a17dc4fce933dc5ec6f40cf8;hpb=f8154c71944186a9b64ddb782082a2026c5a912f;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLRelation.java b/src/org/z3950/zing/cql/CQLRelation.java index ff8db8f..cb2dfb6 100644 --- a/src/org/z3950/zing/cql/CQLRelation.java +++ b/src/org/z3950/zing/cql/CQLRelation.java @@ -1,31 +1,78 @@ -// $Id: CQLRelation.java,v 1.2 2002-10-31 22:22:01 mike Exp $ +// $Id: CQLRelation.java,v 1.11 2003-09-04 21:56:46 mike Exp $ package org.z3950.zing.cql; import java.util.Vector; +import java.util.Properties; import java.lang.StringBuffer; /** * Represents a relation between a CQL qualifier and term. - * ## * - * @version $Id: CQLRelation.java,v 1.2 2002-10-31 22:22:01 mike Exp $ + * @version $Id: CQLRelation.java,v 1.11 2003-09-04 21:56:46 mike Exp $ */ public class CQLRelation extends CQLNode { ModifierSet ms; + /** + * Creates a new CQLRelation with the specified base relation. + * Typical base relations include the usual six ordering relations + * (<=, >, etc.), the text + * relations any, all and exact, the + * server-choice relation scr and profiled relations of + * the form prefix.name. + */ public CQLRelation(String base) { ms = new ModifierSet(base); } + /** + * Returns the base relation with which the CQLRelation was + * originally created. + */ + public String getBase() { + return ms.getBase(); + } + + /** + * Adds a new relation modifier to the specified CQLRelation. + * Typical relation modifiers include relevant, + * fuzzy, stem and phonetic. On the + * whole, these modifiers have a meaningful interpretation only + * for the text relations. + */ public void addModifier(String modifier) { ms.addModifier(null, modifier); } - public String toXCQL(int level) { + /** + * Returns an array of the modifiers associated with a CQLRelation. + * @return + * An array of zero or more Strings, each representing a + * modifier associated with the specified CQLRelation. + */ + public String[] getModifiers() { + Vector[] v = ms.getModifiers(); + int n = v.length; + String[] s = new String[n]; + for (int i = 0; i < n; i++) { + s[i] = (String) v[i].get(1); + } + return s; + } + + public String toXCQL(int level, Vector prefixes) { return ms.toXCQL(level, "relation"); } public String toCQL() { return ms.toCQL(); } + + public String toPQF(Properties config) throws PQFTranslationException { + throw new Error("CQLRelation.toPQF() can never be called"); + } + + public byte[] toType1BER(Properties config) { + throw new Error("CQLRelation.toType1BER() can never be called"); + } }