GeneralEnvelope extends AbstractEnvelope implements Cloneable, Serializable { @Override public boolean equals(final Object object) { if (object != null && object.getClass().equals(getClass())) { final GeneralEnvelope that = (GeneralEnvelope) object; return Arrays.equals(this.ordinates, that.ordinates) && Utilities.equals(this.crs, that.crs); } return false; } GeneralEnvelope(final int dimension);  GeneralEnvelope(final double min, final double max);  GeneralEnvelope(final double[] minDP, final double[] maxDP);  GeneralEnvelope(final GeneralDirectPosition minDP, final GeneralDirectPosition maxDP);  GeneralEnvelope(final CoordinateReferenceSystem crs);  GeneralEnvelope(final Envelope envelope);  GeneralEnvelope(final GeographicBoundingBox box);  GeneralEnvelope(final Rectangle2D rect);  GeneralEnvelope(final GridEnvelope gridRange, final PixelInCell anchor,
            final MathTransform gridToCRS, final CoordinateReferenceSystem crs); static GeneralEnvelope toGeneralEnvelope(final Envelope envelope); final CoordinateReferenceSystem getCoordinateReferenceSystem(); void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs); boolean normalize(final boolean crsDomain); final int getDimension(); @Override DirectPosition getLowerCorner(); @Override DirectPosition getUpperCorner(); DirectPosition getMedian(); final double getMinimum(final int dimension); final double getMaximum(final int dimension); final double getMedian(final int dimension); final double getSpan(final int dimension); double getSpan(final int dimension, final Unit<?> unit); void setRange(final int dimension, double minimum, double maximum); void setEnvelope(final double... ordinates); void setEnvelope(final GeneralEnvelope envelope); void setToInfinite(); boolean isInfinite(); void setToNull(); boolean isNull(); boolean isEmpty(); void add(final DirectPosition position); void add(final Envelope envelope); boolean contains(final DirectPosition position); boolean contains(final Envelope envelope, final boolean edgesInclusive); boolean intersects(final Envelope envelope, final boolean edgesInclusive); void intersect(final Envelope envelope); GeneralEnvelope getSubEnvelope(final int lower, final int upper); GeneralEnvelope getReducedEnvelope(final int lower, final int upper); Rectangle2D toRectangle2D(); @Override int hashCode(); @Override boolean equals(final Object object); boolean equals(final Envelope envelope, final double eps, final boolean epsIsRelative); @Override GeneralEnvelope clone();  }
@Test public void testEquals() { final GeneralEnvelope e1 = new GeneralEnvelope(4); assertTrue(e1.isEmpty()); assertTrue(e1.isNull()); assertEquals(e1.getLowerCorner(), e1.getUpperCorner()); for (int i = e1.getDimension(); --i >= 0;) { e1.setRange(i, i * 5 + 2, i * 6 + 5); } assertFalse(e1.isNull()); assertFalse(e1.isEmpty()); assertFalse(e1.getLowerCorner().equals(e1.getUpperCorner())); final GeneralEnvelope e2 = new GeneralEnvelope(e1); assertPositionEquals(e1.getLowerCorner(), e2.getLowerCorner()); assertPositionEquals(e1.getUpperCorner(), e2.getUpperCorner()); assertTrue(e1.contains(e2, true)); assertFalse(e1.contains(e2, false)); assertNotSame(e1, e2); assertEquals(e1, e2); assertTrue(e1.equals(e2, 1E-4, true)); assertTrue(e1.equals(e2, 1E-4, false)); assertEquals(e1.hashCode(), e2.hashCode()); e2.setRange(2, e2.getMinimum(2) + 3E-5, e2.getMaximum(2) - 3E-5); assertTrue(e1.contains(e2, true)); assertFalse(e1.contains(e2, false)); assertFalse(e1.equals(e2)); assertTrue(e1.equals(e2, 1E-4, true)); assertTrue(e1.equals(e2, 1E-4, false)); assertFalse(e1.hashCode() == e2.hashCode()); e2.setRange(1, e2.getMinimum(1) + 3, e2.getMaximum(1) - 3); assertTrue(e1.contains(e2, true)); assertFalse(e1.contains(e2, false)); assertFalse(e1.equals(e2)); assertFalse(e1.equals(e2, 1E-4, true)); assertFalse(e1.equals(e2, 1E-4, false)); assertFalse(e1.hashCode() == e2.hashCode()); }