Remove CVS expansions
[cql-java-moved-to-github.git] / src / main / java / org / z3950 / zing / cql / CQLRelation.java
1
2 package org.z3950.zing.cql;
3 import java.util.List;
4 import java.util.Properties;
5
6 /**
7  * Represents a relation between a CQL index and term.
8  *
9  */
10 public class CQLRelation extends CQLNode {
11     ModifierSet ms;
12
13     /**
14      * Creates a new CQLRelation with the specified base relation.
15      * Typical base relations include the usual six ordering relations
16      * (<TT>&lt;=</TT>, <TT>&gt</TT>, <I>etc.</I>), the text
17      * relations <TT>any</TT>, <TT>all</TT> and <TT>exact</TT>, the
18      * old server-choice relation <TT>scr</TT> and profiled relations of
19      * the form <TT><I>prefix</I>.<I>name</I></TT>.
20      */
21     // ### Seems wrong: a modifier set should not have a base, a
22     // relation should
23     public CQLRelation(String base) {
24         ms = new ModifierSet(base);
25     }
26
27     /**
28      * Returns the base relation with which the CQLRelation was
29      * originally created.
30      */
31     public String getBase() {
32         return ms.getBase();
33     }
34
35     /**
36      * Returns an array of the modifiers associated with a CQLRelation.
37      * @return
38      *  An array of Modifier objects.
39      */
40     public List<Modifier> getModifiers() {
41         return ms.getModifiers();
42     }
43
44     @Override
45     void toXCQLInternal(XCQLBuilder b, int level, List<CQLPrefix> prefixes,
46       List<ModifierSet> sortkeys) {
47         if (sortkeys != null)
48             throw new Error("CQLRelation.toXCQL() called with sortkeys");
49         ms.toXCQLInternal(b, level, "relation", "value");
50     }
51
52     @Override
53     public String toCQL() {
54         return ms.toCQL();
55     }
56
57     @Override
58     public String toPQF(Properties config) throws PQFTranslationException {
59         throw new Error("CQLRelation.toPQF() can never be called");
60     }
61
62     @Override
63     public byte[] toType1BER(Properties config) {
64         throw new Error("CQLRelation.toType1BER() can never be called");
65     }
66 }