blob: 750c316b4e1446ba46697d041e5a106e9e2c8e14 [file] [log] [blame]
Index: lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java (revision 26b7644d00ccbb01b82a7ecb456e36e7680a0e2d)
+++ lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java (revision )
@@ -1270,17 +1270,24 @@
}
}
}
-
+
@Override
public boolean equals(Object o) {
- // Way too expensive to do this the hard way, so each complex polygon will be considered unique.
- return this == o;
+ if (!(o instanceof GeoComplexPolygon))
+ return false;
+ final GeoComplexPolygon other = (GeoComplexPolygon) o;
+ return super.equals(other) && testPointInSet == testPointInSet
+ && testPoint.equals(testPoint)
+ && pointsList.equals(other.pointsList);
}
@Override
public int hashCode() {
- // Each complex polygon is considered unique.
- return System.identityHashCode(this);
+ int result = super.hashCode();
+ result = 31 * result + Boolean.hashCode(testPointInSet);
+ result = 31 * result + testPoint.hashCode();
+ result = 31 * result + pointsList.hashCode();
+ return result;
}
@Override
Index: lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomBinaryCodecTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomBinaryCodecTest.java (revision 26b7644d00ccbb01b82a7ecb456e36e7680a0e2d)
+++ lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomBinaryCodecTest.java (revision )
@@ -34,10 +34,6 @@
public void testRandomShapeCodec() throws IOException{
PlanetModel planetModel = randomPlanetModel();
int type = randomShapeType();
- while (type == COMPLEX_POLYGON){
- //We need to implement equals method
- type = randomShapeType();
- }
GeoShape shape = randomGeoShape(type, planetModel);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();