From: mike Date: Thu, 12 Dec 2002 10:24:25 +0000 (+0000) Subject: Add Ralph's new getResultSetName() method. X-Git-Tag: v1.5~163 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=d974ba9312ebe456a1fd4fc3d63620e14baef372;p=cql-java-moved-to-github.git Add Ralph's new getResultSetName() method. --- diff --git a/src/org/z3950/zing/cql/CQLNode.java b/src/org/z3950/zing/cql/CQLNode.java index 1eae518..cfc6e29 100644 --- a/src/org/z3950/zing/cql/CQLNode.java +++ b/src/org/z3950/zing/cql/CQLNode.java @@ -1,4 +1,4 @@ -// $Id: CQLNode.java,v 1.20 2002-12-11 17:14:20 mike Exp $ +// $Id: CQLNode.java,v 1.21 2002-12-12 10:24:25 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -8,12 +8,22 @@ import java.util.Vector; /** * Represents a node in a CQL parse-tree. * - * @version $Id: CQLNode.java,v 1.20 2002-12-11 17:14:20 mike Exp $ + * @version $Id: CQLNode.java,v 1.21 2002-12-12 10:24:25 mike Exp $ */ public abstract class CQLNode { CQLNode() {} // prevent javadoc from documenting this /** + * Returns the name of the result-set to which this query is a + * reference, if and only if the entire query consists only of a + * result-set reference. If it's anything else, including a + * boolean combination of a result-set reference with something + * else, then null is returned instead. + * @return the name of the referenced result-set + */ + public String getResultSetName() { return null; } + + /** * Translates a parse-tree into an XCQL document. *

* @param level diff --git a/src/org/z3950/zing/cql/CQLTermNode.java b/src/org/z3950/zing/cql/CQLTermNode.java index 46676f4..399ce10 100644 --- a/src/org/z3950/zing/cql/CQLTermNode.java +++ b/src/org/z3950/zing/cql/CQLTermNode.java @@ -1,4 +1,4 @@ -// $Id: CQLTermNode.java,v 1.17 2002-12-11 17:14:20 mike Exp $ +// $Id: CQLTermNode.java,v 1.18 2002-12-12 10:24:25 mike Exp $ package org.z3950.zing.cql; import java.util.Properties; @@ -12,7 +12,7 @@ import java.util.Vector; * these must be provided - you can't have a qualifier without a * relation or vice versa. * - * @version $Id: CQLTermNode.java,v 1.17 2002-12-11 17:14:20 mike Exp $ + * @version $Id: CQLTermNode.java,v 1.18 2002-12-12 10:24:25 mike Exp $ */ public class CQLTermNode extends CQLNode { private String qualifier; @@ -34,6 +34,13 @@ public class CQLTermNode extends CQLNode { public CQLRelation getRelation() { return relation; } public String getTerm() { return term; } + public String getResultSetName() { + if (qualifier.equals("srw.resultSet")) + return term; + else + return null; + } + public String toXCQL(int level, Vector prefixes) { return (indent(level) + "\n" + renderPrefixes(level+1, prefixes) +