d36c11f559344c3bd7376aa1fd91dca1f6bb8654
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLNode.java
1 // $Id: CQLNode.java,v 1.10 2002-11-05 17:21:30 mike Exp $
2
3 package org.z3950.zing.cql;
4
5
6 /**
7  * Represents a node in a CQL parse-tree.
8  * ##
9  *
10  * @version     $Id: CQLNode.java,v 1.10 2002-11-05 17:21:30 mike Exp $
11  */
12 public abstract class CQLNode {
13     abstract public String toXCQL(int level);
14     abstract public String toCQL();
15
16     // Utility-function abbreviations for the use of subclasses
17     protected static String indent(int level) { return Utils.indent(level); }
18     protected static String xq(String str) { return Utils.xq(str); }
19
20     // Test harness
21     public static void main (String[] args) {
22         CQLNode n1 = new CQLTermNode("dc.author",
23                                      new CQLRelation("="),
24                                      "kernighan");
25         CQLNode n2 = new CQLTermNode("dc.title",
26                                      new CQLRelation("all"),
27                                      "elements style");
28         CQLNode root = new CQLAndNode(n1, n2);
29         System.out.println(root.toXCQL(0));
30     }
31 }