From 63162cbb93bec07caf9a8ec00cb0c006fea8dabd Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Fri, 22 Jul 2011 14:19:31 +0200 Subject: [PATCH] Add override annotations --- src/main/java/org/z3950/zing/cql/CQLAndNode.java | 1 + src/main/java/org/z3950/zing/cql/CQLBooleanNode.java | 4 ++++ src/main/java/org/z3950/zing/cql/CQLLexer.java | 1 + src/main/java/org/z3950/zing/cql/CQLNotNode.java | 1 + src/main/java/org/z3950/zing/cql/CQLOrNode.java | 1 + src/main/java/org/z3950/zing/cql/CQLPrefixNode.java | 4 ++++ src/main/java/org/z3950/zing/cql/CQLProxNode.java | 2 ++ src/main/java/org/z3950/zing/cql/CQLRelation.java | 4 ++++ src/main/java/org/z3950/zing/cql/CQLSortNode.java | 4 ++++ src/main/java/org/z3950/zing/cql/CQLTermNode.java | 4 ++++ 10 files changed, 26 insertions(+) diff --git a/src/main/java/org/z3950/zing/cql/CQLAndNode.java b/src/main/java/org/z3950/zing/cql/CQLAndNode.java index dc452db..a1ebf76 100644 --- a/src/main/java/org/z3950/zing/cql/CQLAndNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLAndNode.java @@ -18,6 +18,7 @@ public class CQLAndNode extends CQLBooleanNode { } // ### Too much code duplication here with OR and NOT + @Override byte[] opType1() { byte[] op = new byte[5]; putTag(CONTEXT, 46, CONSTRUCTED, op, 0); // Operator diff --git a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java index dafb19b..465b725 100644 --- a/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLBooleanNode.java @@ -44,6 +44,7 @@ public abstract class CQLBooleanNode extends CQLNode { this.ms = ms; } + @Override public String toXCQL(int level, List prefixes, List sortkeys) { return (indent(level) + "\n" + @@ -59,6 +60,7 @@ public abstract class CQLBooleanNode extends CQLNode { indent(level) + "\n"); } + @Override public String toCQL() { // ### We don't always need parens around the operands return ("(" + left.toCQL() + ")" + @@ -66,6 +68,7 @@ public abstract class CQLBooleanNode extends CQLNode { "(" + right.toCQL() + ")"); } + @Override public String toPQF(Properties config) throws PQFTranslationException { return ("@" + opPQF() + " " + left.toPQF(config) + @@ -75,6 +78,7 @@ public abstract class CQLBooleanNode extends CQLNode { // represents the operation for PQF: overridden for CQLProxNode String opPQF() { return ms.getBase(); } + @Override public byte[] toType1BER(Properties config) throws PQFTranslationException { System.out.println("in CQLBooleanNode.toType1BER(): PQF=" + toPQF(config)); diff --git a/src/main/java/org/z3950/zing/cql/CQLLexer.java b/src/main/java/org/z3950/zing/cql/CQLLexer.java index b0da745..7bbf115 100644 --- a/src/main/java/org/z3950/zing/cql/CQLLexer.java +++ b/src/main/java/org/z3950/zing/cql/CQLLexer.java @@ -93,6 +93,7 @@ class CQLLexer extends StreamTokenizer { saved_sval = sval; } + @Override public int nextToken() throws java.io.IOException { if (saved_ttype != TT_UNDEFINED) { ttype = saved_ttype; diff --git a/src/main/java/org/z3950/zing/cql/CQLNotNode.java b/src/main/java/org/z3950/zing/cql/CQLNotNode.java index 7b56de3..90346f4 100644 --- a/src/main/java/org/z3950/zing/cql/CQLNotNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLNotNode.java @@ -17,6 +17,7 @@ public class CQLNotNode extends CQLBooleanNode { super(left, right, ms); } + @Override byte[] opType1() { byte[] op = new byte[5]; putTag(CONTEXT, 46, CONSTRUCTED, op, 0); // Operator diff --git a/src/main/java/org/z3950/zing/cql/CQLOrNode.java b/src/main/java/org/z3950/zing/cql/CQLOrNode.java index 9e7d66e..67a292d 100644 --- a/src/main/java/org/z3950/zing/cql/CQLOrNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLOrNode.java @@ -17,6 +17,7 @@ public class CQLOrNode extends CQLBooleanNode { super(left, right, ms); } + @Override byte[] opType1() { byte[] op = new byte[5]; putTag(CONTEXT, 46, CONSTRUCTED, op, 0); // Operator diff --git a/src/main/java/org/z3950/zing/cql/CQLPrefixNode.java b/src/main/java/org/z3950/zing/cql/CQLPrefixNode.java index 84fb9a7..c793d2f 100644 --- a/src/main/java/org/z3950/zing/cql/CQLPrefixNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLPrefixNode.java @@ -41,6 +41,7 @@ public class CQLPrefixNode extends CQLNode { this.subtree = subtree; } + @Override public String toXCQL(int level, List prefixes, List sortkeys) { List tmp = (prefixes == null ? @@ -50,6 +51,7 @@ public class CQLPrefixNode extends CQLNode { return subtree.toXCQL(level, tmp, sortkeys); } + @Override public String toCQL() { // ### We don't always need parens around the subtree if (prefix.name == null) { @@ -61,6 +63,7 @@ public class CQLPrefixNode extends CQLNode { } } + @Override public String toPQF(Properties config) throws PQFTranslationException { // Prefixes and their identifiers don't actually play any role // in PQF translation, since the meanings of the indexes, @@ -69,6 +72,7 @@ public class CQLPrefixNode extends CQLNode { return subtree.toPQF(config); } + @Override public byte[] toType1BER(Properties config) throws PQFTranslationException { // See comment on toPQF() return subtree.toType1BER(config); diff --git a/src/main/java/org/z3950/zing/cql/CQLProxNode.java b/src/main/java/org/z3950/zing/cql/CQLProxNode.java index 2ce355f..9f1f0c3 100644 --- a/src/main/java/org/z3950/zing/cql/CQLProxNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLProxNode.java @@ -29,6 +29,7 @@ public class CQLProxNode extends CQLBooleanNode { * which-code ::= 'known' | 'private' | integer. * unit-code ::= integer. */ + @Override String opPQF() { int relCode = getRelCode(); int unitCode = getProxUnitCode(); @@ -77,6 +78,7 @@ public class CQLProxNode extends CQLBooleanNode { } + @Override byte[] opType1() { byte[] op = new byte[100]; int offset, value; diff --git a/src/main/java/org/z3950/zing/cql/CQLRelation.java b/src/main/java/org/z3950/zing/cql/CQLRelation.java index 9e17d27..44a55e6 100644 --- a/src/main/java/org/z3950/zing/cql/CQLRelation.java +++ b/src/main/java/org/z3950/zing/cql/CQLRelation.java @@ -43,6 +43,7 @@ public class CQLRelation extends CQLNode { return ms.getModifiers(); } + @Override public String toXCQL(int level, List prefixes, List sortkeys) { if (sortkeys != null) @@ -51,14 +52,17 @@ public class CQLRelation extends CQLNode { return ms.toXCQL(level, "relation"); } + @Override public String toCQL() { return ms.toCQL(); } + @Override public String toPQF(Properties config) throws PQFTranslationException { throw new Error("CQLRelation.toPQF() can never be called"); } + @Override public byte[] toType1BER(Properties config) { throw new Error("CQLRelation.toType1BER() can never be called"); } diff --git a/src/main/java/org/z3950/zing/cql/CQLSortNode.java b/src/main/java/org/z3950/zing/cql/CQLSortNode.java index 306f8c6..1c3aa14 100644 --- a/src/main/java/org/z3950/zing/cql/CQLSortNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLSortNode.java @@ -42,6 +42,7 @@ public class CQLSortNode extends CQLNode { return keys; } + @Override public String toXCQL(int level, List prefixes, List sortkeys) { if (sortkeys != null) @@ -49,6 +50,7 @@ public class CQLSortNode extends CQLNode { return subtree.toXCQL(level, prefixes, keys); } + @Override public String toCQL() { StringBuffer buf = new StringBuffer(subtree.toCQL()); @@ -63,10 +65,12 @@ public class CQLSortNode extends CQLNode { return buf.toString(); } + @Override public String toPQF(Properties config) throws PQFTranslationException { return "@attr 1=oops \"###\""; } + @Override public byte[] toType1BER(Properties config) throws PQFTranslationException { // There is no way to represent sorting in a standard Z39.50 diff --git a/src/main/java/org/z3950/zing/cql/CQLTermNode.java b/src/main/java/org/z3950/zing/cql/CQLTermNode.java index 1f03a4e..b45abdc 100644 --- a/src/main/java/org/z3950/zing/cql/CQLTermNode.java +++ b/src/main/java/org/z3950/zing/cql/CQLTermNode.java @@ -52,6 +52,7 @@ public class CQLTermNode extends CQLNode { return null; } + @Override public String toXCQL(int level, List prefixes, List sortkeys) { return (indent(level) + "\n" + @@ -63,6 +64,7 @@ public class CQLTermNode extends CQLNode { indent(level) + "\n"); } + @Override public String toCQL() { String quotedIndex = maybeQuote(index); String quotedTerm = maybeQuote(term); @@ -158,6 +160,7 @@ public class CQLTermNode extends CQLNode { return attrs; } + @Override public String toPQF(Properties config) throws PQFTranslationException { if (isResultSetIndex(index)) { // Special case: ignore relation, modifiers, wildcards, etc. @@ -204,6 +207,7 @@ public class CQLTermNode extends CQLNode { return str; } + @Override public byte[] toType1BER(Properties config) throws PQFTranslationException { if (isResultSetIndex(index)) { // Special case: ignore relation, modifiers, wildcards, etc. -- 1.7.10.4