1 // $Id: CQLProxNode.java,v 1.2 2002-11-06 00:05:58 mike Exp $
3 package org.z3950.zing.cql;
7 * Represents a proximity node in a CQL parse-tree.
8 * The left- and right-hand-sides must be satisfied by parts of the
9 * candidate records which are sufficiently close to each other, as
10 * specified by a set of proximity parameters.
12 * @version $Id: CQLProxNode.java,v 1.2 2002-11-06 00:05:58 mike Exp $
14 public class CQLProxNode extends CQLBooleanNode {
18 * Creates a new, <I>incomplete</I>, proximity node with the
19 * specified left-hand side. No right-hand side is specified at
20 * this stage: that must be specified later, using the
21 * <TT>addSecondSubterm()</TT> method. (That may seem odd, but
22 * it's just easier to write the parser that way.)
24 * Proximity paramaters may be added at any time, before or after
25 * the right-hand-side sub-tree is added.
27 public CQLProxNode(CQLNode left) {
28 ms = new ModifierSet("prox");
30 // this.right left unresolved for now ...
34 * Sets the right-hand side of the proximity node whose
35 * left-hand-side was specified at creation time.
37 public void addSecondSubterm(CQLNode right) {
46 * Adds a modifier of the specified <TT>type</TT> and
47 * <TT>value</TT> to a proximity node. Valid types are
48 * <TT>relation</TT>, <TT>distance</TT>, <TT>unit</TT> and
51 * For information on the semantics of these paramaters, see
52 * <A href="http://zing.z3950.org/cql/intro.html#3.1"
53 * >section 3.1 (Proximity)</A> of
54 * <I>A Gentle Introduction to CQL</I></A>.
56 public void addModifier(String type, String value) {
57 ms.addModifier(type, value);
60 // ### should have a public method to retrieve all modifiers
62 String booleanXQL(int level) {
63 return ms.toXCQL(level, "boolean");