From 8cf2c45ba7e58c2940d1f73923c7ade542fd5086 Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 27 Jun 2007 22:14:03 +0000 Subject: [PATCH] addModifier() now accepts comparison as well as type and value. --- src/org/z3950/zing/cql/CQLProxNode.java | 19 ++++++------------- src/org/z3950/zing/cql/ModifierSet.java | 16 ++++++++-------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/org/z3950/zing/cql/CQLProxNode.java b/src/org/z3950/zing/cql/CQLProxNode.java index d0ac772..244cf9c 100644 --- a/src/org/z3950/zing/cql/CQLProxNode.java +++ b/src/org/z3950/zing/cql/CQLProxNode.java @@ -1,4 +1,4 @@ -// $Id: CQLProxNode.java,v 1.8 2007-06-27 17:02:01 mike Exp $ +// $Id: CQLProxNode.java,v 1.9 2007-06-27 22:15:04 mike Exp $ package org.z3950.zing.cql; import java.util.Vector; @@ -10,7 +10,7 @@ import java.util.Vector; * candidate records which are sufficiently close to each other, as * specified by a set of proximity parameters. * - * @version $Id: CQLProxNode.java,v 1.8 2007-06-27 17:02:01 mike Exp $ + * @version $Id: CQLProxNode.java,v 1.9 2007-06-27 22:15:04 mike Exp $ */ public class CQLProxNode extends CQLBooleanNode { ModifierSet ms; @@ -40,18 +40,11 @@ public class CQLProxNode extends CQLBooleanNode { } /** - * Adds a modifier of the specified type and - * value to a proximity node. Valid types are - * relation, distance, unit and - * ordering. - *

- * For information on the semantics of these paramaters, see - * section 3.1 (Proximity) of - * A Gentle Introduction to CQL. + * Adds a modifier of the specified type, + * comparison and value to a proximity node. */ - public void addModifier(String type, String value) { - ms.addModifier(type, value); + public void addModifier(String type, String comparison, String value) { + ms.addModifier(type, comparison, value); } /** diff --git a/src/org/z3950/zing/cql/ModifierSet.java b/src/org/z3950/zing/cql/ModifierSet.java index 79e09e9..ee185a3 100644 --- a/src/org/z3950/zing/cql/ModifierSet.java +++ b/src/org/z3950/zing/cql/ModifierSet.java @@ -1,4 +1,4 @@ -// $Id: ModifierSet.java,v 1.9 2007-06-27 17:01:38 mike Exp $ +// $Id: ModifierSet.java,v 1.10 2007-06-27 22:14:03 mike Exp $ package org.z3950.zing.cql; import java.util.Vector; @@ -15,7 +15,7 @@ import java.lang.StringBuffer; * zero or more type comparison value pairs, * where type, comparison and value are all strings. * - * @version $Id: ModifierSet.java,v 1.9 2007-06-27 17:01:38 mike Exp $ + * @version $Id: ModifierSet.java,v 1.10 2007-06-27 22:14:03 mike Exp $ */ public class ModifierSet { String base; @@ -37,12 +37,12 @@ public class ModifierSet { } /** - * Adds a modifier of the specified type and + * Adds a modifier of the specified type, comparison and * value to a ModifierSet. */ - public void addModifier(String type, String value) { + public void addModifier(String type, String comparison, String value) { // ### Need to have comparison passed in - Modifier modifier = new Modifier(type, null, value); + Modifier modifier = new Modifier(type, comparison, value); modifiers.add(modifier); } @@ -96,13 +96,13 @@ public class ModifierSet { public static void main(String[] args) { if (args.length < 1) { - System.err.println("Usage: ModifierSet [ ]..."); + System.err.println("Usage: ModifierSet [ ]..."); System.exit(1); } ModifierSet res = new ModifierSet(args[0]); - for (int i = 1; i < args.length; i += 2) { - res.addModifier(args[i], args[i+1]); + for (int i = 1; i < args.length; i += 3) { + res.addModifier(args[i], args[i+1], args[i+2]); } System.out.println(res.toCQL()); -- 1.7.10.4