/** * Returns a hash value for this envelope. This value need not remain consistent between * different implementations of the same class. */ @Override public int hashCode() { int code = super.hashCode() ^ (int) serialVersionUID; if (crs != null) { code ^= crs.hashCode(); } return code; }
@Override public int hashCode() { //FYI if geometry.equalsExact(that.geometry), then their envelopes are the same. return geom.getEnvelopeInternal().hashCode(); }
/** * Returns a hash value for this envelope. This value need not remain * consistent between different implementations of the same class. */ @Override public int hashCode() { int code = super.hashCode() ^ (int) serialVersionUID; if (crs != null) { code ^= crs.hashCode(); } return code; }
/** * Gets a hash code for the Geometry. * * @return an integer value suitable for use as a hashcode */ public int hashCode() { return getEnvelopeInternal().hashCode(); }
public void testEquals() throws Exception { Envelope e1 = new Envelope(1, 2, 3, 4); Envelope e2 = new Envelope(1, 2, 3, 4); assertEquals(e1, e2); assertEquals(e1.hashCode(), e2.hashCode()); Envelope e3 = new Envelope(1, 2, 3, 5); assertTrue(!e1.equals(e3)); assertTrue(e1.hashCode() != e3.hashCode()); e1.setToNull(); assertTrue(!e1.equals(e2)); assertTrue(e1.hashCode() != e2.hashCode()); e2.setToNull(); assertEquals(e1, e2); assertEquals(e1.hashCode(), e2.hashCode()); }