X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FModifierSet.java;h=8c5ec16a67132ed2a0efe56c7d406e26e77ce5ee;hb=8e35f984081a29de9b53af7c1b2fbf981c474d88;hp=79e09e9bb8cbd52bed1859385ccede438e2cf41f;hpb=604454dff6ed638f7dd2527abf2cee2594c9f4d6;p=cql-java-moved-to-github.git
diff --git a/src/org/z3950/zing/cql/ModifierSet.java b/src/org/z3950/zing/cql/ModifierSet.java
index 79e09e9..8c5ec16 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.12 2007-06-29 10:20:41 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.12 2007-06-29 10:20:41 mike Exp $
*/
public class ModifierSet {
String base;
@@ -37,12 +37,20 @@ public class ModifierSet {
}
/**
- * Adds a modifier of the specified type and
- * value to a ModifierSet.
+ * Adds a modifier of the specified type,
+ * comparison and value to a ModifierSet.
*/
- public void addModifier(String type, String value) {
- // ### Need to have comparison passed in
- Modifier modifier = new Modifier(type, null, value);
+ public void addModifier(String type, String comparison, String value) {
+ Modifier modifier = new Modifier(type, comparison, value);
+ modifiers.add(modifier);
+ }
+
+ /**
+ * Adds a modifier of the specified type, but with no
+ * comparison and value, to a ModifierSet.
+ */
+ public void addModifier(String type) {
+ Modifier modifier = new Modifier(type);
modifiers.add(modifier);
}
@@ -77,7 +85,7 @@ public class ModifierSet {
if (modifiers.size() > 0) {
buf.append(Utils.indent(level+1) + "\n");
for (int i = 0; i < modifiers.size(); i++) {
- buf.append(modifiers.get(i).toXCQL(level+2, "relation"));
+ buf.append(modifiers.get(i).toXCQL(level+2, "comparison"));
}
buf.append(Utils.indent(level+1) + "\n");
}
@@ -96,13 +104,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());