Finish (more or less) to CQL-to-PQF translator.
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLRelation.java
1 // $Id: CQLRelation.java,v 1.5 2002-11-06 20:13:45 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.5 2002-11-06 20:13:45 mike Exp $
12  */
13 public class CQLRelation extends CQLNode {
14     ModifierSet ms;
15
16     public CQLRelation(String base) {
17         ms = new ModifierSet(base);
18     }
19
20     public String getBase() {
21         return ms.getBase();
22     }
23
24     public void addModifier(String modifier) {
25         ms.addModifier(null, modifier);
26     }
27
28     public String[] getModifiers() {
29         Vector[] v = ms.getModifiers();
30         int n = v.length;
31         String[] s = new String[n];
32         for (int i = 0; i < n; i++) {
33             s[i] = (String) v[i].get(1);
34         }
35         return s;
36     }
37
38     public String toXCQL(int level) {
39         return ms.toXCQL(level, "relation");
40     }
41
42     public String toCQL() {
43         return ms.toCQL();
44     }
45
46     public String toPQF(Properties config) throws PQFTranslationException {
47         throw new Error("CQLRelation.toPQF() can never be called");
48     }
49 }