From: Jakub Skoczen Date: Fri, 22 Jul 2011 13:09:07 +0000 (+0200) Subject: Import statics directly, bump version X-Git-Tag: v1.8~5 X-Git-Url: http://jira.indexdata.com/?a=commitdiff_plain;h=7cff92fa0b727aa844456f130744ec2fe263ba48;p=cql-java-moved-to-github.git Import statics directly, bump version --- diff --git a/VERSION b/VERSION index d3bdbdf..6259340 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7 +1.8 diff --git a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java index 465b725..19f96c7 100644 --- a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java @@ -4,6 +4,8 @@ package org.z3950.zing.cql; import java.util.List; import java.util.Properties; +import static org.z3950.zing.cql.Utils.*; + /** * Represents a boolean node in a CQL parse-tree. diff --git a/src/main/java/org/z3950/zing/cql/CQLNode.java b/src/main/java/org/z3950/zing/cql/CQLNode.java index 34add8e..88b50ca 100644 --- a/src/main/java/org/z3950/zing/cql/CQLNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLNode.java @@ -6,6 +6,8 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import static org.z3950.zing.cql.Utils.*; + /** * Represents a node in a CQL parse-tree. @@ -113,18 +115,6 @@ public abstract class CQLNode { 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 < is translated to - * &lt;. - */ - 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 diff --git a/src/main/java/org/z3950/zing/cql/CQLTermNode.java b/src/main/java/org/z3950/zing/cql/CQLTermNode.java index 5966700..cdb62f7 100644 --- a/src/main/java/org/z3950/zing/cql/CQLTermNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLTermNode.java @@ -5,6 +5,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; +import static org.z3950.zing.cql.Utils.*; + /** * Represents a terminal node in a CQL parse-tree. diff --git a/src/main/java/org/z3950/zing/cql/Modifier.java b/src/main/java/org/z3950/zing/cql/Modifier.java index 9057dee..d85c8a1 100644 --- a/src/main/java/org/z3950/zing/cql/Modifier.java +++ b/src/main/java/org/z3950/zing/cql/Modifier.java @@ -2,6 +2,8 @@ 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 @@ -61,18 +63,18 @@ public class Modifier { public String toXCQL(int level, String relationElement) { StringBuilder buf = new StringBuilder(); - buf.append(Utils.indent(level)).append("\n"). - append(Utils.indent(level + 1)).append(""). - append(Utils.xq(type)).append("\n"); + buf.append(indent(level)).append("\n"). + append(indent(level + 1)).append(""). + append(xq(type)).append("\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("\n"). - append(Utils.indent(level + 1)).append(""). - append(Utils.xq(value)).append("\n"); + append(indent(level + 1)).append(""). + append(xq(value)).append("\n"); } - buf.append(Utils.indent(level)).append("\n"); + buf.append(indent(level)).append("\n"); return buf.toString(); } diff --git a/src/main/java/org/z3950/zing/cql/ModifierSet.java b/src/main/java/org/z3950/zing/cql/ModifierSet.java index ce5915c..213f199 100644 --- a/src/main/java/org/z3950/zing/cql/ModifierSet.java +++ b/src/main/java/org/z3950/zing/cql/ModifierSet.java @@ -4,6 +4,8 @@ package org.z3950.zing.cql; import java.util.ArrayList; import java.util.List; +import static org.z3950.zing.cql.Utils.*; + /** * Represents a base String and a set of Modifiers. *

@@ -88,18 +90,18 @@ public class ModifierSet { 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("\n").append(indent(level + 1)).append("<"). + append(valueElement).append(">").append(xq(base)).append("\n"); if (modifiers.size() > 0) { - buf.append(Utils.indent(level + 1)).append("\n"); + buf.append(indent(level + 1)).append("\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("\n"); + buf.append(indent(level + 1)).append("\n"); } - buf.append(Utils.indent(level)).append("\n"); return buf.toString(); }