Added CQLBooleanNode (where had it gone?!)
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLNode.java
1 // $Id: CQLNode.java,v 1.3 2002-10-25 16:04:44 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.3 2002-10-25 16:04:44 mike Exp $
11  */
12 public abstract class CQLNode {
13     abstract String toXCQL(int level);
14     abstract String toCQL();
15
16     protected String indent(int level) {
17         String x = "";
18         while (level-- > 0) {
19             x += "  ";
20         }
21         return x;
22     }
23
24     // Test harness
25     public static void main (String[] args) {
26         CQLNode n1 = new CQLTermNode("dc.author", "=", "kernighan");
27         CQLNode n2 = new CQLTermNode("dc.title", "all", "elements style");
28         CQLNode root = new CQLAndNode(n1, n2);
29         System.out.println(root.toXCQL(3));
30     }
31 }