Index: src/java/org/apache/lucene/analysis/NumericTokenStream.java
===================================================================
--- src/java/org/apache/lucene/analysis/NumericTokenStream.java (revision 820569)
+++ src/java/org/apache/lucene/analysis/NumericTokenStream.java (working copy)
@@ -195,14 +195,14 @@
return this;
}
- // @Override
+ @Override
public void reset() {
if (valSize == 0)
throw new IllegalStateException("call set???Value() before usage");
shift = 0;
}
- // @Override
+ @Override
public boolean incrementToken() {
if (valSize == 0)
throw new IllegalStateException("call set???Value() before usage");
@@ -233,7 +233,7 @@
return true;
}
- // @Override
+ @Override
public String toString() {
final StringBuffer sb = new StringBuffer("(numeric,valSize=").append(valSize);
sb.append(",precisionStep=").append(precisionStep).append(')');
Index: src/java/org/apache/lucene/document/NumericField.java
===================================================================
--- src/java/org/apache/lucene/document/NumericField.java (revision 820569)
+++ src/java/org/apache/lucene/document/NumericField.java (working copy)
@@ -212,6 +212,7 @@
}
/** Returns always null for numeric fields */
+ @Override
public byte[] getBinaryValue(byte[] result){
return null;
}
Index: src/java/org/apache/lucene/search/MultiTermQuery.java
===================================================================
--- src/java/org/apache/lucene/search/MultiTermQuery.java (revision 820569)
+++ src/java/org/apache/lucene/search/MultiTermQuery.java (working copy)
@@ -264,11 +264,13 @@
}
}
+ @Override
public int hashCode() {
final int prime = 1279;
return (int) (prime * termCountCutoff + Double.doubleToLongBits(docCountPercent));
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -303,10 +305,12 @@
* instance; you'll need to create a private instance
* instead. */
public final static RewriteMethod CONSTANT_SCORE_AUTO_REWRITE_DEFAULT = new ConstantScoreAutoRewrite() {
+ @Override
public void setTermCountCutoff(int count) {
throw new UnsupportedOperationException("Please create a private instance");
}
+ @Override
public void setDocCountPercent(double percent) {
throw new UnsupportedOperationException("Please create a private instance");
}
@@ -387,6 +391,7 @@
* Implemented for back compat in case MultiTermQuery
* subclasses do no implement.
*/
+ @Override
public String toString(String field) {
StringBuffer buffer = new StringBuffer();
if (term != null) {
@@ -417,7 +422,7 @@
rewriteMethod = method;
}
- //@Override
+ @Override
public int hashCode() {
final int prime = 31;
int result = 1;
@@ -427,7 +432,7 @@
return result;
}
- //@Override
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
Index: src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
===================================================================
--- src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java (revision 820569)
+++ src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java (working copy)
@@ -51,13 +51,13 @@
this.query = query;
}
- //@Override
+ @Override
public String toString() {
// query.toString should be ok for the filter, too, if the query boost is 1.0f
return query.toString();
}
- //@Override
+ @Override
public final boolean equals(final Object o) {
if (o==this) return true;
if (o==null) return false;
@@ -67,7 +67,7 @@
return false;
}
- //@Override
+ @Override
public final int hashCode() {
return query.hashCode();
}
@@ -135,7 +135,7 @@
* not.
* @deprecated Use {@link #getDocIdSet(IndexReader)} instead.
*/
- //@Override
+ @Override
public BitSet bits(IndexReader reader) throws IOException {
final TermEnum enumerator = query.getEnum(reader);
try {
@@ -155,7 +155,7 @@
* Returns a DocIdSet with documents that should be
* permitted in search results.
*/
- //@Override
+ @Override
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
final TermEnum enumerator = query.getEnum(reader);
try {
Index: src/java/org/apache/lucene/search/NumericRangeFilter.java
===================================================================
--- src/java/org/apache/lucene/search/NumericRangeFilter.java (revision 820569)
+++ src/java/org/apache/lucene/search/NumericRangeFilter.java (working copy)
@@ -47,9 +47,9 @@
*
* @since 2.9
**/
-public final class NumericRangeFilter extends MultiTermQueryWrapperFilter {
+public final class NumericRangeFilter extends MultiTermQueryWrapperFilter {
- private NumericRangeFilter(final NumericRangeQuery query) {
+ private NumericRangeFilter(final NumericRangeQuery query) {
super(query);
}
@@ -60,10 +60,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newLongRange(final String field, final int precisionStep,
+ public static NumericRangeFilter newLongRange(final String field, final int precisionStep,
Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newLongRange(field, precisionStep, min, max, minInclusive, maxInclusive)
);
}
@@ -75,10 +75,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newLongRange(final String field,
+ public static NumericRangeFilter newLongRange(final String field,
Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newLongRange(field, min, max, minInclusive, maxInclusive)
);
}
@@ -90,10 +90,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newIntRange(final String field, final int precisionStep,
+ public static NumericRangeFilter newIntRange(final String field, final int precisionStep,
Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newIntRange(field, precisionStep, min, max, minInclusive, maxInclusive)
);
}
@@ -105,10 +105,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newIntRange(final String field,
+ public static NumericRangeFilter newIntRange(final String field,
Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newIntRange(field, min, max, minInclusive, maxInclusive)
);
}
@@ -120,10 +120,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newDoubleRange(final String field, final int precisionStep,
+ public static NumericRangeFilter newDoubleRange(final String field, final int precisionStep,
Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newDoubleRange(field, precisionStep, min, max, minInclusive, maxInclusive)
);
}
@@ -135,10 +135,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newDoubleRange(final String field,
+ public static NumericRangeFilter newDoubleRange(final String field,
Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newDoubleRange(field, min, max, minInclusive, maxInclusive)
);
}
@@ -150,10 +150,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newFloatRange(final String field, final int precisionStep,
+ public static NumericRangeFilter newFloatRange(final String field, final int precisionStep,
Float min, Float max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newFloatRange(field, precisionStep, min, max, minInclusive, maxInclusive)
);
}
@@ -165,27 +165,32 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeFilter newFloatRange(final String field,
+ public static NumericRangeFilter newFloatRange(final String field,
Float min, Float max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeFilter(
+ return new NumericRangeFilter(
NumericRangeQuery.newFloatRange(field, min, max, minInclusive, maxInclusive)
);
}
/** Returns the field name for this filter */
- public String getField() { return ((NumericRangeQuery)query).getField(); }
+ @SuppressWarnings("unchecked")
+ public String getField() { return ((NumericRangeQuery)query).getField(); }
/** Returns true if the lower endpoint is inclusive */
- public boolean includesMin() { return ((NumericRangeQuery)query).includesMin(); }
+ @SuppressWarnings("unchecked")
+ public boolean includesMin() { return ((NumericRangeQuery)query).includesMin(); }
/** Returns true if the upper endpoint is inclusive */
- public boolean includesMax() { return ((NumericRangeQuery)query).includesMax(); }
+ @SuppressWarnings("unchecked")
+ public boolean includesMax() { return ((NumericRangeQuery)query).includesMax(); }
/** Returns the lower value of this range filter */
- public Number getMin() { return ((NumericRangeQuery)query).getMin(); }
+ @SuppressWarnings("unchecked")
+ public T getMin() { return ((NumericRangeQuery)query).getMin(); }
/** Returns the upper value of this range filter */
- public Number getMax() { return ((NumericRangeQuery)query).getMax(); }
+ @SuppressWarnings("unchecked")
+ public T getMax() { return ((NumericRangeQuery)query).getMax(); }
}
Index: src/java/org/apache/lucene/search/NumericRangeQuery.java
===================================================================
--- src/java/org/apache/lucene/search/NumericRangeQuery.java (revision 820569)
+++ src/java/org/apache/lucene/search/NumericRangeQuery.java (working copy)
@@ -154,10 +154,10 @@
*
* @since 2.9
**/
-public final class NumericRangeQuery extends MultiTermQuery {
+public final class NumericRangeQuery extends MultiTermQuery {
private NumericRangeQuery(final String field, final int precisionStep, final int valSize,
- Number min, Number max, final boolean minInclusive, final boolean maxInclusive
+ T min, T max, final boolean minInclusive, final boolean maxInclusive
) {
assert (valSize == 32 || valSize == 64);
if (precisionStep < 1)
@@ -200,10 +200,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newLongRange(final String field, final int precisionStep,
+ public static NumericRangeQuery newLongRange(final String field, final int precisionStep,
Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, precisionStep, 64, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, precisionStep, 64, min, max, minInclusive, maxInclusive);
}
/**
@@ -213,10 +213,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newLongRange(final String field,
+ public static NumericRangeQuery newLongRange(final String field,
Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 64, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 64, min, max, minInclusive, maxInclusive);
}
/**
@@ -226,10 +226,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newIntRange(final String field, final int precisionStep,
+ public static NumericRangeQuery newIntRange(final String field, final int precisionStep,
Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, precisionStep, 32, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, precisionStep, 32, min, max, minInclusive, maxInclusive);
}
/**
@@ -239,10 +239,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newIntRange(final String field,
+ public static NumericRangeQuery newIntRange(final String field,
Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 32, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 32, min, max, minInclusive, maxInclusive);
}
/**
@@ -252,10 +252,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newDoubleRange(final String field, final int precisionStep,
+ public static NumericRangeQuery newDoubleRange(final String field, final int precisionStep,
Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, precisionStep, 64, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, precisionStep, 64, min, max, minInclusive, maxInclusive);
}
/**
@@ -265,10 +265,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newDoubleRange(final String field,
+ public static NumericRangeQuery newDoubleRange(final String field,
Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 64, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 64, min, max, minInclusive, maxInclusive);
}
/**
@@ -278,10 +278,10 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newFloatRange(final String field, final int precisionStep,
+ public static NumericRangeQuery newFloatRange(final String field, final int precisionStep,
Float min, Float max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, precisionStep, 32, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, precisionStep, 32, min, max, minInclusive, maxInclusive);
}
/**
@@ -291,13 +291,13 @@
* by setting the min or max value to null. By setting inclusive to false, it will
* match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
*/
- public static NumericRangeQuery newFloatRange(final String field,
+ public static NumericRangeQuery newFloatRange(final String field,
Float min, Float max, final boolean minInclusive, final boolean maxInclusive
) {
- return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 32, min, max, minInclusive, maxInclusive);
+ return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, 32, min, max, minInclusive, maxInclusive);
}
- //@Override
+ @Override
protected FilteredTermEnum getEnum(final IndexReader reader) throws IOException {
return new NumericRangeTermEnum(reader);
}
@@ -312,12 +312,12 @@
public boolean includesMax() { return maxInclusive; }
/** Returns the lower value of this range query */
- public Number getMin() { return min; }
+ public T getMin() { return min; }
/** Returns the upper value of this range query */
- public Number getMax() { return max; }
+ public T getMax() { return max; }
- //@Override
+ @Override
public String toString(final String field) {
final StringBuffer sb = new StringBuffer();
if (!this.field.equals(field)) sb.append(this.field).append(':');
@@ -330,7 +330,7 @@
.toString();
}
- //@Override
+ @Override
public final boolean equals(final Object o) {
if (o==this) return true;
if (!super.equals(o))
@@ -349,7 +349,7 @@
return false;
}
- //@Override
+ @Override
public final int hashCode() {
int hash = super.hashCode();
hash += field.hashCode()^0x4565fd66 + precisionStep^0x64365465;
@@ -363,7 +363,7 @@
// members (package private, to be also fast accessible by NumericRangeTermEnum)
final String field;
final int precisionStep, valSize;
- final Number min, max;
+ final T min, max;
final boolean minInclusive,maxInclusive;
/**
@@ -379,7 +379,7 @@
private final class NumericRangeTermEnum extends FilteredTermEnum {
private final IndexReader reader;
- private final LinkedList/**/ rangeBounds = new LinkedList/**/();
+ private final LinkedList rangeBounds = new LinkedList();
private String currentUpperBound = null;
NumericRangeTermEnum(final IndexReader reader) throws IOException {
@@ -412,7 +412,7 @@
}
NumericUtils.splitLongRange(new NumericUtils.LongRangeBuilder() {
- //@Override
+ @Override
public final void addRange(String minPrefixCoded, String maxPrefixCoded) {
rangeBounds.add(minPrefixCoded);
rangeBounds.add(maxPrefixCoded);
@@ -447,7 +447,7 @@
}
NumericUtils.splitIntRange(new NumericUtils.IntRangeBuilder() {
- //@Override
+ @Override
public final void addRange(String minPrefixCoded, String maxPrefixCoded) {
rangeBounds.add(minPrefixCoded);
rangeBounds.add(maxPrefixCoded);
@@ -465,13 +465,13 @@
next();
}
- //@Override
+ @Override
public float difference() {
return 1.0f;
}
/** this is a dummy, it is not used by this class. */
- //@Override
+ @Override
protected boolean endEnum() {
assert false; // should never be called
return (currentTerm != null);
@@ -484,13 +484,13 @@
* of false ends iterating the current enum
* and forwards to the next sub-range.
*/
- //@Override
+ @Override
protected boolean termCompare(Term term) {
return (term.field() == field && term.text().compareTo(currentUpperBound) <= 0);
}
/** Increments the enumeration to the next element. True if one exists. */
- //@Override
+ @Override
public boolean next() throws IOException {
// if a current term exists, the actual enum is initialized:
// try change to next term, if no such term exists, fall-through
@@ -510,8 +510,8 @@
actualEnum.close();
actualEnum = null;
}
- final String lowerBound = (String)rangeBounds.removeFirst();
- this.currentUpperBound = (String)rangeBounds.removeFirst();
+ final String lowerBound = rangeBounds.removeFirst();
+ this.currentUpperBound = rangeBounds.removeFirst();
// this call recursively uses next(), if no valid term in
// next enum found.
// if this behavior is changed/modified in the superclass,
@@ -521,7 +521,7 @@
}
/** Closes the enumeration to further activity, freeing resources. */
- //@Override
+ @Override
public void close() throws IOException {
rangeBounds.clear();
currentUpperBound = null;