First semi-working version.
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLBooleanNode.java
1 // $Id: CQLBooleanNode.java,v 1.3 2002-10-25 16:56:43 mike Exp $
2
3 package org.z3950.zing.cql;
4
5
6 /**
7  * Represents a boolean node in a CQL parse-tree ...
8  * ###
9  *
10  * @version     $Id: CQLBooleanNode.java,v 1.3 2002-10-25 16:56:43 mike Exp $
11  */
12 public abstract class CQLBooleanNode extends CQLNode {
13     protected CQLNode left;
14     protected CQLNode right;
15
16     abstract String op();
17
18     String toXCQL(int level) {
19         return(indent(level) + "<triple>\n" +
20                indent(level+1) + "<boolean>" + op() + "</boolean>\n" +
21                left.toXCQL(level+1) +
22                right.toXCQL(level+1) +
23                indent(level) + "</triple>\n");
24     }
25
26     String toCQL() {
27         return "(" + left.toCQL() + ") " + op() + " (" + right.toCQL() + ")";
28     }
29 }