Simplify getModifiers.
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLRelation.java
1 // $Id: CQLRelation.java,v 1.12 2007-06-27 17:03:17 mike Exp $
2
3 package org.z3950.zing.cql;
4 import java.util.Vector;
5 import java.util.Properties;
6 import java.lang.StringBuffer;
7
8 /**
9  * Represents a relation between a CQL qualifier and term.
10  *
11  * @version     $Id: CQLRelation.java,v 1.12 2007-06-27 17:03:17 mike Exp $
12  */
13 public class CQLRelation extends CQLNode {
14     ModifierSet ms;
15
16     /**
17      * Creates a new CQLRelation with the specified base relation.
18      * Typical base relations include the usual six ordering relations
19      * (<TT>&lt;=</TT>, <TT>&gt</TT>, <I>etc.</I>), the text
20      * relations <TT>any</TT>, <TT>all</TT> and <TT>exact</TT>, the
21      * server-choice relation <TT>scr</TT> and profiled relations of
22      * the form <TT><I>prefix</I>.<I>name</I></TT>.
23      */
24     public CQLRelation(String base) {
25         ms = new ModifierSet(base);
26     }
27
28     /**
29      * Returns the base relation with which the CQLRelation was
30      * originally created.
31      */
32     public String getBase() {
33         return ms.getBase();
34     }
35
36     /**
37      * Adds a new relation modifier to the specified CQLRelation.
38      * Typical relation modifiers include <TT>relevant</TT>,
39      * <TT>fuzzy</TT>, <TT>stem</TT> and <TT>phonetic</TT>.  On the
40      * whole, these modifiers have a meaningful interpretation only
41      * for the text relations.
42      */
43     public void addModifier(String modifier) {
44         ms.addModifier(null, modifier);
45     }
46
47     /**
48      * Returns an array of the modifiers associated with a CQLRelation.
49      * @return
50      *  An array of Modifier objects.
51      */
52     public Vector<Modifier> getModifiers() {
53         return ms.getModifiers();
54     }
55
56     public String toXCQL(int level, Vector prefixes) {
57         return ms.toXCQL(level, "relation");
58     }
59
60     public String toCQL() {
61         return ms.toCQL();
62     }
63
64     public String toPQF(Properties config) throws PQFTranslationException {
65         throw new Error("CQLRelation.toPQF() can never be called");
66     }
67
68     public byte[] toType1BER(Properties config) {
69         throw new Error("CQLRelation.toType1BER() can never be called");
70     }
71 }