put more out-commented @Overrides back in. Add more.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@825891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-10-16 13:42:41 +00:00
parent 59534306ee
commit 1c6720816f
16 changed files with 53 additions and 31 deletions

View File

@ -27,7 +27,7 @@ import org.apache.lucene.util.StringHelper;
Note that terms may represent more than words from text fields, but also
things like dates, email addresses, urls, etc. */
public final class Term implements Comparable, java.io.Serializable {
public final class Term implements Comparable<Term>, java.io.Serializable {
String field;
String text;
@ -74,7 +74,7 @@ public final class Term implements Comparable, java.io.Serializable {
return new Term(field,text,false);
}
//@Override
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@ -96,7 +96,7 @@ public final class Term implements Comparable, java.io.Serializable {
return true;
}
//@Override
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
@ -105,10 +105,6 @@ public final class Term implements Comparable, java.io.Serializable {
return result;
}
public int compareTo(Object other) {
return compareTo((Term)other);
}
/** Compares two terms, returning a negative integer if this
term belongs before the argument, zero if this term is equal to the
argument, and a positive integer if this term belongs after the argument.
@ -127,6 +123,7 @@ public final class Term implements Comparable, java.io.Serializable {
text = txt;
}
@Override
public final String toString() { return field + ":" + text; }
private void readObject(java.io.ObjectInputStream in)

View File

@ -34,10 +34,12 @@ public abstract class DocIdSet {
public int nextDoc() throws IOException { return NO_MORE_DOCS; }
};
@Override
public DocIdSetIterator iterator() {
return iterator;
}
@Override
public boolean isCacheable() {
return true;
}

View File

@ -478,10 +478,12 @@ public abstract class FieldCacheRangeFilter extends Filter {
abstract boolean matchDoc(int doc) throws ArrayIndexOutOfBoundsException;
/** this DocIdSet is cacheable, if it works solely with FieldCache and no TermDocs */
@Override
public boolean isCacheable() {
return !(mayUseTermDocs && reader.hasDeletions());
}
@Override
public DocIdSetIterator iterator() throws IOException {
// Synchronization needed because deleted docs BitVector
// can change after call to hasDeletions until TermDocs creation.

View File

@ -126,11 +126,13 @@ public class FieldCacheTermsFilter extends Filter {
}
}
@Override
public DocIdSetIterator iterator() {
return new FieldCacheTermsFilterDocIdSetIterator();
}
/** This DocIdSet implementation is cacheable. */
@Override
public boolean isCacheable() {
return true;
}

View File

@ -50,6 +50,7 @@ public abstract class FilteredDocIdSet extends DocIdSet {
}
/** This DocIdSet implementation is cacheable if the inner set is cacheable. */
@Override
public boolean isCacheable() {
return _innerSet.isCacheable();
}
@ -66,7 +67,7 @@ public abstract class FilteredDocIdSet extends DocIdSet {
* @see DocIdSetIterator
* @see FilteredDocIdSetIterator
*/
// @Override
@Override
public DocIdSetIterator iterator() throws IOException {
return new FilteredDocIdSetIterator(_innerSet.iterator()) {
protected boolean match(int docid) throws IOException {

View File

@ -44,26 +44,32 @@ public class QueryWrapperFilter extends Filter {
this.query = query;
}
@Override
public DocIdSet getDocIdSet(final IndexReader reader) throws IOException {
final Weight weight = query.weight(new IndexSearcher(reader));
return new DocIdSet() {
@Override
public DocIdSetIterator iterator() throws IOException {
return weight.scorer(reader, true, false);
}
@Override
public boolean isCacheable() { return false; }
};
}
@Override
public String toString() {
return "QueryWrapperFilter(" + query + ")";
}
@Override
public boolean equals(Object o) {
if (!(o instanceof QueryWrapperFilter))
return false;
return this.query.equals(((QueryWrapperFilter)o).query);
}
@Override
public int hashCode() {
return query.hashCode() ^ 0x923F64B9;
}

View File

@ -752,11 +752,11 @@ public abstract class Similarity implements Serializable {
if(supportedMethods.overridesTermIDF) {
final float idf = idf(term, searcher);
return new IDFExplanation() {
//@Override
@Override
public float getIdf() {
return idf;
}
//@Override
@Override
public String explain() {
return "Inexplicable";
}
@ -766,12 +766,12 @@ public abstract class Similarity implements Serializable {
final int max = searcher.maxDoc();
final float idf = idf(df, max);
return new IDFExplanation() {
//@Override
@Override
public String explain() {
return "idf(docFreq=" + df +
", maxDocs=" + max + ")";
}
//@Override
@Override
public float getIdf() {
return idf;
}};
@ -814,11 +814,11 @@ public abstract class Similarity implements Serializable {
if(supportedMethods.overridesCollectionIDF) {
final float idf = idf(terms, searcher);
return new IDFExplanation() {
//@Override
@Override
public float getIdf() {
return idf;
}
//@Override
@Override
public String explain() {
return "Inexplicable";
}
@ -839,11 +839,11 @@ public abstract class Similarity implements Serializable {
}
final float fIdf = idf;
return new IDFExplanation() {
//@Override
@Override
public float getIdf() {
return fIdf;
}
//@Override
@Override
public String explain() {
return exp.toString();
}

View File

@ -130,12 +130,14 @@ public class TermRangeQuery extends MultiTermQuery {
/** Returns the collator used to determine range inclusion, if any. */
public Collator getCollator() { return collator; }
@Override
protected FilteredTermEnum getEnum(IndexReader reader) throws IOException {
return new TermRangeTermEnum(reader, field, lowerTerm,
upperTerm, includeLower, includeUpper, collator);
}
/** Prints a user-readable version of this query. */
@Override
public String toString(String field) {
StringBuilder buffer = new StringBuilder();
if (!getField().equals(field)) {
@ -151,7 +153,7 @@ public class TermRangeQuery extends MultiTermQuery {
return buffer.toString();
}
//@Override
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
@ -164,7 +166,7 @@ public class TermRangeQuery extends MultiTermQuery {
return result;
}
//@Override
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;

View File

@ -66,10 +66,12 @@ public class PayloadNearQuery extends SpanNearQuery {
this.function = function;
}
@Override
public Weight createWeight(Searcher searcher) throws IOException {
return new PayloadNearSpanWeight(this, searcher);
}
@Override
public Object clone() {
int sz = clauses.size();
SpanQuery[] newClauses = new SpanQuery[sz];
@ -84,6 +86,7 @@ public class PayloadNearQuery extends SpanNearQuery {
return boostingNearQuery;
}
@Override
public String toString(String field) {
StringBuilder buffer = new StringBuilder();
buffer.append("payloadNear([");
@ -104,7 +107,7 @@ public class PayloadNearQuery extends SpanNearQuery {
return buffer.toString();
}
// @Override
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
@ -113,7 +116,7 @@ public class PayloadNearQuery extends SpanNearQuery {
return result;
}
// @Override
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@ -146,6 +149,7 @@ public class PayloadNearQuery extends SpanNearQuery {
similarity, reader.norms(query.getField()));
}
@Override
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
boolean topScorer) throws IOException {
return new PayloadNearSpanScorer(query.getSpans(reader), this,
@ -215,12 +219,14 @@ public class PayloadNearQuery extends SpanNearQuery {
return super.setFreqCurrentDoc();
}
@Override
public float score() throws IOException {
return super.score()
* function.docScore(doc, fieldName, payloadsSeen, payloadScore);
}
@Override
public Explanation explain(int doc) throws IOException {
Explanation result = new Explanation();
Explanation nonPayloadExpl = super.explain(doc);

View File

@ -112,11 +112,13 @@ public class OpenBitSet extends DocIdSet implements Cloneable, Serializable {
this.wlen = numWords;
}
@Override
public DocIdSetIterator iterator() {
return new OpenBitSetIterator(bits, wlen);
}
/** This DocIdSet implementation is cacheable. */
@Override
public boolean isCacheable() {
return true;
}

View File

@ -46,7 +46,7 @@ public class SimpleStringInterner extends StringInterner {
this.maxChainLength = Math.max(2,maxChainLength);
}
// @Override
@Override
public String intern(String s) {
int h = s.hashCode();
// In the future, it may be worth augmenting the string hash

View File

@ -181,6 +181,7 @@ public class SortedVIntList extends DocIdSet {
}
/** This DocIdSet implementation is cacheable. */
@Override
public boolean isCacheable() {
return true;
}
@ -188,6 +189,7 @@ public class SortedVIntList extends DocIdSet {
/**
* @return An iterator over the sorted integers.
*/
@Override
public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
int bytePos = 0;

View File

@ -42,7 +42,7 @@ public class TestDocIdSet extends LuceneTestCase {
final int maxdoc=10;
final DocIdSet innerSet = new DocIdSet() {
// @Override
@Override
public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
@ -52,13 +52,13 @@ public class TestDocIdSet extends LuceneTestCase {
return docid;
}
//@Override
@Override
public int nextDoc() throws IOException {
docid++;
return docid < maxdoc ? docid : (docid = NO_MORE_DOCS);
}
//@Override
@Override
public int advance(int target) throws IOException {
while (nextDoc() < target) {}
return docid;
@ -69,7 +69,7 @@ public class TestDocIdSet extends LuceneTestCase {
DocIdSet filteredSet = new FilteredDocIdSet(innerSet){
// @Override
@Override
protected boolean match(int docid) {
return docid%2 == 0; //validate only even docids
}

View File

@ -65,19 +65,19 @@ public abstract class LocalizedTestCase extends LuceneTestCase {
this.testWithDifferentLocales = testWithDifferentLocales;
}
// @Override
@Override
protected void setUp() throws Exception {
super.setUp();
Locale.setDefault(locale);
}
// @Override
@Override
protected void tearDown() throws Exception {
Locale.setDefault(defaultLocale);
super.tearDown();
}
// @Override
@Override
public void runBare() throws Throwable {
// Do the test with the default Locale (default)
try {

View File

@ -199,7 +199,7 @@ public abstract class LuceneTestCase extends TestCase {
return new Random(seed);
}
// @Override
@Override
public void runBare() throws Throwable {
try {
seed = null;

View File

@ -179,7 +179,7 @@ public class TestNumericUtils extends LuceneTestCase {
final OpenBitSet bits=useBitSet ? new OpenBitSet(upper-lower+1) : null;
NumericUtils.splitLongRange(new NumericUtils.LongRangeBuilder() {
//@Override
@Override
public void addRange(long min, long max, int shift) {
assertTrue("min, max should be inside bounds", min>=lower && min<=upper && max>=lower && max<=upper);
if (useBitSet) for (long l=min; l<=max; l++) {
@ -261,7 +261,7 @@ public class TestNumericUtils extends LuceneTestCase {
final OpenBitSet bits=useBitSet ? new OpenBitSet(upper-lower+1) : null;
NumericUtils.splitIntRange(new NumericUtils.IntRangeBuilder() {
//@Override
@Override
public void addRange(int min, int max, int shift) {
assertTrue("min, max should be inside bounds", min>=lower && min<=upper && max>=lower && max<=upper);
if (useBitSet) for (int i=min; i<=max; i++) {