X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLRelation.java;h=36fae4ad65c80adb0448894c7771bf0222c4d46f;hb=394625a21876d096000c4940049305c27de90321;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..36fae4a 100644 --- a/src/org/z3950/zing/cql/CQLRelation.java +++ b/src/org/z3950/zing/cql/CQLRelation.java @@ -1,26 +1,64 @@ -// $Id: CQLRelation.java,v 1.2 2002-10-31 22:22:01 mike Exp $ +// $Id: CQLRelation.java,v 1.6 2002-11-17 23:29:02 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.6 2002-11-17 23:29:02 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 and the + * server-choice relation scr. + */ 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); } + /** + * 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) { return ms.toXCQL(level, "relation"); } @@ -28,4 +66,8 @@ public class CQLRelation extends CQLNode { public String toCQL() { return ms.toCQL(); } + + public String toPQF(Properties config) throws PQFTranslationException { + throw new Error("CQLRelation.toPQF() can never be called"); + } }