From c6ea17b35591bac083db07f3437cdc46edd87f29 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 3 Jul 2007 13:30:18 +0000 Subject: [PATCH] toXCQL() refactored as layer over new underlyingToXCQL() Add sortKeyToXCQL() as another layer over underlyingToXCQL() --- src/org/z3950/zing/cql/ModifierSet.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/org/z3950/zing/cql/ModifierSet.java b/src/org/z3950/zing/cql/ModifierSet.java index 8c5ec16..7b6991a 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.12 2007-06-29 10:20:41 mike Exp $ +// $Id: ModifierSet.java,v 1.13 2007-07-03 13:30:18 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.12 2007-06-29 10:20:41 mike Exp $ + * @version $Id: ModifierSet.java,v 1.13 2007-07-03 13:30:18 mike Exp $ */ public class ModifierSet { String base; @@ -78,10 +78,20 @@ public class ModifierSet { } public String toXCQL(int level, String topLevelElement) { + return underlyingToXCQL(level, topLevelElement, "value"); + } + + public String sortKeyToXCQL(int level) { + return underlyingToXCQL(level, "key", "index"); + } + + private String underlyingToXCQL(int level, String topLevelElement, + String valueElement) { StringBuffer buf = new StringBuffer(); buf.append(Utils.indent(level) + "<" + topLevelElement + ">\n"); buf.append(Utils.indent(level+1) + - "" + Utils.xq(base) + "\n"); + "<" + valueElement + ">" + Utils.xq(base) + + "\n"); if (modifiers.size() > 0) { buf.append(Utils.indent(level+1) + "\n"); for (int i = 0; i < modifiers.size(); i++) { -- 1.7.10.4