X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLNode.java;h=4eb80234cddd7dde7dbb0a12ff3b91e6517a94d9;hb=08b7f3f08d97b9efdd5a3aef7992a359b71910d6;hp=baa6cad12d7adc6a2c4ff00695c7fffa02d09186;hpb=9b7bbaf04b9492a1071d10fe5a1ce3f1ee60a0fc;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLNode.java b/src/org/z3950/zing/cql/CQLNode.java index baa6cad..4eb8023 100644 --- a/src/org/z3950/zing/cql/CQLNode.java +++ b/src/org/z3950/zing/cql/CQLNode.java @@ -1,38 +1,30 @@ -// $Id: CQLNode.java,v 1.5 2002-10-27 00:46:25 mike Exp $ +// $Id: CQLNode.java,v 1.9 2002-10-31 22:22:01 mike Exp $ package org.z3950.zing.cql; /** - * Represents a node in a CQL parse-tree ... - * ### + * Represents a node in a CQL parse-tree. + * ## * - * @version $Id: CQLNode.java,v 1.5 2002-10-27 00:46:25 mike Exp $ + * @version $Id: CQLNode.java,v 1.9 2002-10-31 22:22:01 mike Exp $ */ public abstract class CQLNode { abstract String toXCQL(int level); abstract String toCQL(); - protected String indent(int level) { - String x = ""; - while (level-- > 0) { - x += " "; - } - return x; - } - - protected String xq(String str) { - // XML Quote - // ### s/&/&/g; - // s//>/g; - return str; - } + // Utility-function abbreviations for the use of subclasses + protected static String indent(int level) { return Utils.indent(level); } + protected static String xq(String str) { return Utils.xq(str); } // Test harness public static void main (String[] args) { - CQLNode n1 = new CQLTermNode("dc.author", "=", "kernighan"); - CQLNode n2 = new CQLTermNode("dc.title", "all", "elements style"); + CQLNode n1 = new CQLTermNode("dc.author", + new CQLRelation("="), + "kernighan"); + CQLNode n2 = new CQLTermNode("dc.title", + new CQLRelation("all"), + "elements style"); CQLNode root = new CQLAndNode(n1, n2); System.out.println(root.toXCQL(0)); }