1 // $Id: CQLBooleanNode.java,v 1.8 2002-11-06 20:13:45 mike Exp $
3 package org.z3950.zing.cql;
4 import java.util.Properties;
8 * Represents a boolean node in a CQL parse-tree.
10 * @version $Id: CQLBooleanNode.java,v 1.8 2002-11-06 20:13:45 mike Exp $
12 public abstract class CQLBooleanNode extends CQLNode {
13 CQLBooleanNode() {} // prevent javadoc from documenting this
16 * The root of a parse-tree representing the left-hand side.
21 * The root of a parse-tree representing the right-hand side.
25 public String toXCQL(int level) {
26 return (indent(level) + "<triple>\n" +
28 left.toXCQL(level+1) +
29 right.toXCQL(level+1) +
30 indent(level) + "</triple>\n");
33 // Represents the boolean operation itself: overridden for CQLProxNode
34 String opXQL(int level) {
35 return(indent(level) + "<boolean>\n" +
36 indent(level+1) + "<value>" + op() + "</value>\n" +
37 indent(level) + "</boolean>\n");
40 public String toCQL() {
41 // ### We don't always need parens around the operands
42 return "(" + left.toCQL() + ") " + op() + " (" + right.toCQL() + ")";
45 public String toPQF(Properties config) throws PQFTranslationException {
46 return ("@" + opPQF() +
47 " " + left.toPQF(config) +
48 " " + right.toPQF(config));
51 // represents the operation for PQF: overridden for CQLProxNode
52 String opPQF() { return op(); }