From b6207f73b2c9cf685b2a216ad27e1ad4722535cc Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 29 Jun 2007 10:21:30 +0000 Subject: [PATCH] Boolean node now carries a ModifierSet. Base constructor provided for subclasses to invoke. --- src/org/z3950/zing/cql/CQLBooleanNode.java | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/org/z3950/zing/cql/CQLBooleanNode.java b/src/org/z3950/zing/cql/CQLBooleanNode.java index 794e2ac..c449ce9 100644 --- a/src/org/z3950/zing/cql/CQLBooleanNode.java +++ b/src/org/z3950/zing/cql/CQLBooleanNode.java @@ -1,4 +1,4 @@ -// $Id: CQLBooleanNode.java,v 1.14 2007-06-06 12:22:01 mike Exp $ +// $Id: CQLBooleanNode.java,v 1.15 2007-06-29 10:21:30 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -8,11 +8,9 @@ import java.util.Vector; /** * Represents a boolean node in a CQL parse-tree. * - * @version $Id: CQLBooleanNode.java,v 1.14 2007-06-06 12:22:01 mike Exp $ + * @version $Id: CQLBooleanNode.java,v 1.15 2007-06-29 10:21:30 mike Exp $ */ public abstract class CQLBooleanNode extends CQLNode { - CQLBooleanNode() {} // prevent javadoc from documenting this - /** * The root of a parse-tree representing the left-hand side. */ @@ -23,11 +21,22 @@ public abstract class CQLBooleanNode extends CQLNode { */ public CQLNode right; + /** + * The set of modifiers that are applied to this boolean. + */ + public ModifierSet ms; + + protected CQLBooleanNode(CQLNode left, CQLNode right, ModifierSet ms) { + this.left = left; + this.right = right; + this.ms = ms; + } + public String toXCQL(int level, Vector prefixes) { // ### Should this use CQLNode.toXCQL(level+2, prefixes)? return (indent(level) + "\n" + renderPrefixes(level+1, prefixes) + - opXCQL(level+1) + + ms.toXCQL(level+1, "boolean") + indent(level+1) + "\n" + left.toXCQL(level+2) + indent(level+1) + "\n" + @@ -37,13 +46,6 @@ public abstract class CQLBooleanNode extends CQLNode { indent(level) + "\n"); } - // Represents the boolean operation itself: overridden for CQLProxNode - String opXCQL(int level) { - return(indent(level) + "\n" + - indent(level+1) + "" + op() + "\n" + - indent(level) + "\n"); - } - public String toCQL() { // ### We don't always need parens around the operands return "(" + left.toCQL() + ") " + op() + " (" + right.toCQL() + ")"; -- 1.7.10.4