mirror of https://github.com/apache/lucene.git
add override annotations, fix geohash hashcode, simplify other hashcodes
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@881364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2650c93595
commit
603d6d8a7e
|
@ -85,11 +85,11 @@ public class GeohashFunction extends ValueSource {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int result = lat.hashCode();
|
||||
result = 31 * result + lon.hashCode();
|
||||
result = 31 * name().hashCode();
|
||||
result = 29 * result - lon.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name()).append('(');
|
||||
|
|
|
@ -108,6 +108,7 @@ public class GeohashHaversineFunction extends ValueSource {
|
|||
geoHash2.createWeight(context, searcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this.getClass() != o.getClass()) return false;
|
||||
GeohashHaversineFunction other = (GeohashHaversineFunction) o;
|
||||
|
@ -120,15 +121,15 @@ public class GeohashHaversineFunction extends ValueSource {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = geoHash1.hashCode();
|
||||
result = 31 * result + geoHash2.hashCode();
|
||||
result = 31 * result + name().hashCode();
|
||||
temp = radius != +0.0d ? Double.doubleToLongBits(radius) : 0L;
|
||||
long temp =Double.doubleToRawLongBits(radius);
|
||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name()).append('(');
|
||||
|
|
|
@ -126,6 +126,7 @@ public class HaversineFunction extends ValueSource {
|
|||
y2.createWeight(context, searcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this.getClass() != o.getClass()) return false;
|
||||
HaversineFunction other = (HaversineFunction) o;
|
||||
|
@ -145,7 +146,7 @@ public class HaversineFunction extends ValueSource {
|
|||
result = 31 * result + x2.hashCode();
|
||||
result = 31 * result + y2.hashCode();
|
||||
result = 31 * result + name().hashCode();
|
||||
temp = radius != +0.0d ? Double.doubleToLongBits(radius) : 0L;
|
||||
temp = Double.doubleToRawLongBits(radius);
|
||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class VectorDistanceFunction extends ValueSource {
|
|||
|
||||
protected String name() {
|
||||
return "dist";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the distance
|
||||
|
@ -129,7 +129,7 @@ public class VectorDistanceFunction extends ValueSource {
|
|||
}
|
||||
|
||||
public double doubleVal(int doc) {
|
||||
return (double) distance(doc, valsArr1, valsArr2);
|
||||
return distance(doc, valsArr1, valsArr2);
|
||||
}
|
||||
|
||||
public String strVal(int doc) {
|
||||
|
@ -187,10 +187,11 @@ public class VectorDistanceFunction extends ValueSource {
|
|||
public int hashCode() {
|
||||
int result = sources1.hashCode();
|
||||
result = 31 * result + sources2.hashCode();
|
||||
result = 31 * result + (power != +0.0f ? Float.floatToIntBits(power) : 0);
|
||||
result = 31 * result + Float.floatToRawIntBits(power);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name()).append('(').append(power).append(',');
|
||||
|
|
Loading…
Reference in New Issue