import java.util.List;
import java.util.Properties;
+import static org.z3950.zing.cql.Utils.*;
+
/**
* Represents a boolean node in a CQL parse-tree.
import java.util.Map;
import java.util.Properties;
+import static org.z3950.zing.cql.Utils.*;
+
/**
* Represents a node in a CQL parse-tree.
throws PQFTranslationException;
/**
- * Returns a String of spaces for indenting to the specified level.
- */
- protected static String indent(int level) { return Utils.indent(level); }
-
- /**
- * Returns the argument String quoted for XML.
- * For example, each occurrence of <TT><</TT> is translated to
- * <TT>&lt;</TT>.
- */
- protected static String xq(String str) { return Utils.xq(str); }
-
- /**
* Renders a parser-tree into a BER-endoded packet representing an
* equivalent Z39.50 Type-1 query. If you don't know what that
* means, then you don't need this method :-) This is useful
import java.util.List;
import java.util.Properties;
+import static org.z3950.zing.cql.Utils.*;
+
/**
* Represents a terminal node in a CQL parse-tree.
package org.z3950.zing.cql;
+import static org.z3950.zing.cql.Utils.*;
+
/**
* Represents a single modifier, consisting of three elements: a type,
* a comparision and a value. For example, "distance", "<", "3". The
public String toXCQL(int level, String relationElement) {
StringBuilder buf = new StringBuilder();
- buf.append(Utils.indent(level)).append("<modifier>\n").
- append(Utils.indent(level + 1)).append("<type>").
- append(Utils.xq(type)).append("</type>\n");
+ buf.append(indent(level)).append("<modifier>\n").
+ append(indent(level + 1)).append("<type>").
+ append(xq(type)).append("</type>\n");
if (value != null) {
- buf.append(Utils.indent(level + 1)).append("<").
+ buf.append(indent(level + 1)).append("<").
append(relationElement).append(">").
- append(Utils.xq(comparison)).append("</").
+ append(xq(comparison)).append("</").
append(relationElement).append(">\n").
- append(Utils.indent(level + 1)).append("<value>").
- append(Utils.xq(value)).append("</value>\n");
+ append(indent(level + 1)).append("<value>").
+ append(xq(value)).append("</value>\n");
}
- buf.append(Utils.indent(level)).append("</modifier>\n");
+ buf.append(indent(level)).append("</modifier>\n");
return buf.toString();
}
import java.util.ArrayList;
import java.util.List;
+import static org.z3950.zing.cql.Utils.*;
+
/**
* Represents a base String and a set of Modifiers.
* <P>
private String underlyingToXCQL(int level, String topLevelElement,
String valueElement) {
StringBuilder buf = new StringBuilder();
- buf.append(Utils.indent(level)).append("<").append(topLevelElement).
- append(">\n").append(Utils.indent(level + 1)).append("<").
- append(valueElement).append(">").append(Utils.xq(base)).append("</").
+ buf.append(indent(level)).append("<").append(topLevelElement).
+ append(">\n").append(indent(level + 1)).append("<").
+ append(valueElement).append(">").append(xq(base)).append("</").
append(valueElement).append(">\n");
if (modifiers.size() > 0) {
- buf.append(Utils.indent(level + 1)).append("<modifiers>\n");
+ buf.append(indent(level + 1)).append("<modifiers>\n");
for (int i = 0; i < modifiers.size(); i++) {
buf.append(modifiers.get(i).toXCQL(level+2, "comparison"));
}
- buf.append(Utils.indent(level + 1)).append("</modifiers>\n");
+ buf.append(indent(level + 1)).append("</modifiers>\n");
}
- buf.append(Utils.indent(level)).append("</").append(topLevelElement).
+ buf.append(indent(level)).append("</").append(topLevelElement).
append(">\n");
return buf.toString();
}