GeoLocationPointList extends AbstractGeoLocation { @Override @Pure public Rectangle2d toBounds2D() { if (this.bounds == null && this.pts != null) { double x1 = Double.MAX_VALUE; double y1 = Double.MAX_VALUE; double x2 = Double.MIN_VALUE; double y2 = Double.MIN_VALUE; for (int i = 0; i < this.pts.length; i += 2) { if (this.pts[i] < x1) { x1 = this.pts[i]; } if (this.pts[i] > x2) { x2 = this.pts[i]; } if (this.pts[i + 1] < y1) { y1 = this.pts[i + 1]; } if (this.pts[i + 1] > y2) { y2 = this.pts[i + 1]; } } this.bounds = new Rectangle2d(); this.bounds.setFromCorners(x1, y1, x2, y2); } return this.bounds; } GeoLocationPointList(double... points); @Override @Pure GeoId toGeoId(); @Override @SuppressWarnings("checkstyle:equalshashcode") @Pure int hashCode(); @Pure int size(); @Pure float getX(int index); @Pure float getY(int index); @Override @Pure Rectangle2d toBounds2D(); @Override @Pure GeodesicPosition toGeodesicPosition();  }
@Test public void testToBounds2D() { assertEpsilonEquals(this.b11, this.location11.toBounds2D()); assertEpsilonEquals(this.b12, this.location12.toBounds2D()); assertEpsilonEquals(this.b13, this.location13.toBounds2D()); assertEpsilonEquals(this.b21, this.location21.toBounds2D()); assertEpsilonEquals(this.b22, this.location22.toBounds2D()); assertEpsilonEquals(this.b23, this.location23.toBounds2D()); assertEpsilonEquals(this.location11.toBounds2D(), this.location11.toBounds2D()); assertEpsilonEquals(this.location12.toBounds2D(), this.location11.toBounds2D()); assertNotEquals(this.location13.toBounds2D(), this.location11.toBounds2D()); assertNotEquals(this.location21.toBounds2D(), this.location11.toBounds2D()); assertNotEquals(this.location22.toBounds2D(), this.location11.toBounds2D()); assertNotEquals(this.location23.toBounds2D(), this.location11.toBounds2D()); assertEpsilonEquals(this.location11.toBounds2D(), this.location12.toBounds2D()); assertEpsilonEquals(this.location12.toBounds2D(), this.location12.toBounds2D()); assertNotEquals(this.location13.toBounds2D(), this.location12.toBounds2D()); assertNotEquals(this.location21.toBounds2D(), this.location12.toBounds2D()); assertNotEquals(this.location22.toBounds2D(), this.location12.toBounds2D()); assertNotEquals(this.location23.toBounds2D(), this.location12.toBounds2D()); assertNotEquals(this.location11.toBounds2D(), this.location13.toBounds2D()); assertNotEquals(this.location12.toBounds2D(), this.location13.toBounds2D()); assertEpsilonEquals(this.location13.toBounds2D(), this.location13.toBounds2D()); assertNotEquals(this.location21.toBounds2D(), this.location13.toBounds2D()); assertNotEquals(this.location22.toBounds2D(), this.location13.toBounds2D()); assertNotEquals(this.location23.toBounds2D(), this.location13.toBounds2D()); assertNotEquals(this.location11.toBounds2D(), this.location21.toBounds2D()); assertNotEquals(this.location12.toBounds2D(), this.location21.toBounds2D()); assertNotEquals(this.location13.toBounds2D(), this.location21.toBounds2D()); assertEpsilonEquals(this.location21.toBounds2D(), this.location21.toBounds2D()); assertEpsilonEquals(this.location22.toBounds2D(), this.location21.toBounds2D()); assertNotEquals(this.location23.toBounds2D(), this.location21.toBounds2D()); assertNotEquals(this.location11.toBounds2D(), this.location22.toBounds2D()); assertNotEquals(this.location12.toBounds2D(), this.location22.toBounds2D()); assertNotEquals(this.location13.toBounds2D(), this.location22.toBounds2D()); assertEpsilonEquals(this.location21.toBounds2D(), this.location22.toBounds2D()); assertEpsilonEquals(this.location22.toBounds2D(), this.location22.toBounds2D()); assertNotEquals(this.location23.toBounds2D(), this.location22.toBounds2D()); assertNotEquals(this.location11.toBounds2D(), this.location23.toBounds2D()); assertNotEquals(this.location12.toBounds2D(), this.location23.toBounds2D()); assertNotEquals(this.location13.toBounds2D(), this.location23.toBounds2D()); assertNotEquals(this.location21.toBounds2D(), this.location23.toBounds2D()); assertNotEquals(this.location22.toBounds2D(), this.location23.toBounds2D()); assertEpsilonEquals(this.location23.toBounds2D(), this.location23.toBounds2D()); }