From: Jakub Skoczen Date: Fri, 22 Jul 2011 15:26:28 +0000 (+0200) Subject: Move some code around, simplify X-Git-Tag: v1.8~2 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b9f0ad15f2fadc4cb9a0f035d7efdd3c94a75272;p=cql-java-moved-to-github.git Move some code around, simplify --- diff --git a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java index d5a81e8..902e6b5 100644 --- a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java @@ -48,7 +48,7 @@ public abstract class CQLBooleanNode extends CQLNode { List prefixes, List sortkeys) { b.indent(level).append("\n"); renderPrefixes(b, level + 1, prefixes); - ms.toXCQLInternal(b, level + 1, "boolean"); + ms.toXCQLInternal(b, level + 1, "boolean", "value"); b.indent(level + 1).append("\n"); left.toXCQLInternal(b, level + 2); b.indent(level + 1).append("\n"); diff --git a/src/main/java/org/z3950/zing/cql/CQLNode.java b/src/main/java/org/z3950/zing/cql/CQLNode.java index afaa892..4ba6649 100644 --- a/src/main/java/org/z3950/zing/cql/CQLNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLNode.java @@ -64,9 +64,9 @@ public abstract class CQLNode { if (p.name != null) b.indent(level + 2).append(""). append(p.name).append("\n"); - b.indent(level + 2).append("").append(p.identifier). - append("\n"); - b.indent(level+1).append("\n"); + b.indent(level + 2).append(""). + append(p.identifier).append("\n"); + b.indent(level+1).append("\n"); } b.indent(level).append("\n"); } @@ -78,7 +78,7 @@ public abstract class CQLNode { b.indent(level).append("\n"); for (int i = 0; i < sortkeys.size(); i++) { ModifierSet key = sortkeys.get(i); - b.append(key.sortKeyToXCQL(level+1)); + key.toXCQLInternal(b, level+1, "key", "index"); } b.indent(level).append("\n"); } diff --git a/src/main/java/org/z3950/zing/cql/CQLRelation.java b/src/main/java/org/z3950/zing/cql/CQLRelation.java index 351d8d4..4e9fd27 100644 --- a/src/main/java/org/z3950/zing/cql/CQLRelation.java +++ b/src/main/java/org/z3950/zing/cql/CQLRelation.java @@ -48,7 +48,7 @@ public class CQLRelation extends CQLNode { List sortkeys) { if (sortkeys != null) throw new Error("CQLRelation.toXCQL() called with sortkeys"); - ms.toXCQLInternal(b, level, "relation"); + ms.toXCQLInternal(b, level, "relation", "value"); } @Override diff --git a/src/main/java/org/z3950/zing/cql/Modifier.java b/src/main/java/org/z3950/zing/cql/Modifier.java index 8c5cef7..91d3a17 100644 --- a/src/main/java/org/z3950/zing/cql/Modifier.java +++ b/src/main/java/org/z3950/zing/cql/Modifier.java @@ -58,7 +58,7 @@ public class Modifier { return value; } - protected XCQLBuilder toXCQLInternal(XCQLBuilder b, int level, String relationElement) { + void toXCQLInternal(XCQLBuilder b, int level, String relationElement) { b.indent(level).append("\n"); b.indent(level + 1).append(""); b.xq(type).append("\n"); @@ -68,7 +68,7 @@ public class Modifier { b.indent(level + 1).append(""); b.xq(value).append("\n"); } - return b.indent(level).append("\n"); + b.indent(level).append("\n"); } public String toCQL() { diff --git a/src/main/java/org/z3950/zing/cql/ModifierSet.java b/src/main/java/org/z3950/zing/cql/ModifierSet.java index c04bb88..7eb965f 100644 --- a/src/main/java/org/z3950/zing/cql/ModifierSet.java +++ b/src/main/java/org/z3950/zing/cql/ModifierSet.java @@ -77,20 +77,7 @@ public class ModifierSet { return modifiers; } - public String toXCQL(int level, String topLevelElement) { - return "";//underlyingToXCQL(level, topLevelElement, "value"); - } - - public String sortKeyToXCQL(int level) { - return "";//underlyingToXCQL(level, "key", "index"); - } - - protected XCQLBuilder toXCQLInternal(XCQLBuilder b, int level, - String topLevelElement) { - return toXCQLInternal(b, level, topLevelElement, "value"); - } - - private XCQLBuilder toXCQLInternal(XCQLBuilder b, int level, + void toXCQLInternal(XCQLBuilder b, int level, String topLevelElement, String valueElement) { b.indent(level).append("<").append(topLevelElement). append(">\n").indent(level + 1).append("<"). @@ -104,7 +91,6 @@ public class ModifierSet { b.indent(level + 1).append("\n"); } b.indent(level).append("\n"); - return b; } public String toCQL() {