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