ESRIBounds implements Comparable<ESRIBounds> { public ESRIBounds createUnion(ESRIBounds bounds) { final ESRIBounds eb = new ESRIBounds(); eb.minx = (bounds.minx < this.minx) ? bounds.minx : this.minx; eb.maxx = (bounds.maxx < this.maxx) ? this.maxx : bounds.maxx; eb.miny = (bounds.miny < this.miny) ? bounds.miny : this.miny; eb.maxy = (bounds.maxy < this.maxy) ? this.maxy : bounds.maxy; eb.minz = (bounds.minz < this.minz) ? bounds.minz : this.minz; eb.maxz = (bounds.maxz < this.maxz) ? this.maxz : bounds.maxz; eb.minm = (bounds.minm < this.minm) ? bounds.minm : this.minm; eb.maxm = (bounds.maxm < this.maxm) ? this.maxm : bounds.maxm; return eb; } ESRIBounds();  ESRIBounds(ESRIPoint point);  ESRIBounds(double minx, double maxx, double miny, double maxy);  ESRIBounds(double minx, double maxx, double miny, double maxy, double minz, double maxz, double minm, double maxm);  ESRIBounds(ESRIBounds bounds); ESRIBounds createUnion(ESRIBounds bounds); void add(ESRIPoint point); @Override @Pure boolean equals(Object obj); @Pure @Override int hashCode(); @Pure @Override int compareTo(ESRIBounds bounds); @Pure double getMinX(); @Pure double getCenterX(); @Pure double getMaxX(); @Pure double getCenterY(); @Pure double getMinY(); @Pure double getMaxY(); @Pure double getMinZ(); @Pure double getCenterZ(); @Pure double getMaxZ(); @Pure double getMinM(); @Pure double getCenterM(); @Pure double getMaxM(); @Pure Rectangle2d toRectangle2d(); void ensureMinMax(); @Pure @Override String toString();  }
@Test public void testCreateUnion() { double minx2 = -getRandom().nextDouble(); double miny2 = -getRandom().nextDouble(); double minz2 = -getRandom().nextDouble(); double minm2 = -getRandom().nextDouble(); double maxx2 = getRandom().nextDouble(); double maxy2 = getRandom().nextDouble(); double maxz2 = getRandom().nextDouble(); double maxm2 = getRandom().nextDouble(); double x = Math.min(this.minx, minx2); double X = Math.max(this.maxx, maxx2); double y = Math.min(this.miny, miny2); double Y = Math.max(this.maxy, maxy2); double z = Math.min(this.minz, minz2); double Z = Math.max(this.maxz, maxz2); double m = Math.min(this.minm, minm2); double M = Math.max(this.maxm, maxm2); ESRIBounds union = this.bounds.createUnion(new ESRIBounds(x, X, y, Y, z, Z, m, M)); assertNotNull(union); assertEpsilonEquals(x, union.getMinX()); assertEpsilonEquals(X, union.getMaxX()); assertEpsilonEquals(y, union.getMinY()); assertEpsilonEquals(Y, union.getMaxY()); assertEpsilonEquals(z, union.getMinZ()); assertEpsilonEquals(Z, union.getMaxZ()); assertEpsilonEquals(m, union.getMinM()); assertEpsilonEquals(M, union.getMaxM()); }