GeoId implements Serializable, Comparable<GeoId> { @Pure public Rectangle2d toBounds2D() { int startIndex = this.id.indexOf('#'); if (startIndex <= 0) { return null; } try { int endIndex = this.id.indexOf(';', startIndex); if (endIndex <= startIndex) { return null; } final long minx = Long.parseLong(this.id.substring(startIndex + 1, endIndex)); startIndex = endIndex + 1; endIndex = this.id.indexOf(';', startIndex); if (endIndex <= startIndex) { return null; } final long miny = Long.parseLong(this.id.substring(startIndex, endIndex)); startIndex = endIndex + 1; endIndex = this.id.indexOf(';', startIndex); if (endIndex <= startIndex) { return null; } final long maxx = Long.parseLong(this.id.substring(startIndex, endIndex)); startIndex = endIndex + 1; final long maxy = Long.parseLong(this.id.substring(startIndex)); final Rectangle2d r = new Rectangle2d(); r.setFromCorners(minx, miny, maxx, maxy); return r; } catch (Throwable exception) { } return null; } GeoId(String id);   GeoId(double lowerx, double lowery, double upperx, double uppery, String id); @Pure static GeoId valueOf(String geoId); @Override @Pure String toString(); @Pure UUID toUUID(); @Pure @Override int compareTo(GeoId obj); @Pure @Override boolean equals(Object obj); @Pure @Override int hashCode(); @Pure Rectangle2d toBounds2D(); @Pure String getInternalId();  }
@Test public void testToBounds2D() { assertEpsilonEquals(makeBounds(this.loc11), this.id11.toBounds2D()); assertEpsilonEquals(makeBounds(this.loc12), this.id12.toBounds2D()); assertEpsilonEquals(makeBounds(this.loc13), this.id13.toBounds2D()); assertEpsilonEquals(makeBounds(this.loc21), this.id21.toBounds2D()); assertEpsilonEquals(makeBounds(this.loc22), this.id22.toBounds2D()); assertEpsilonEquals(makeBounds(this.loc23), this.id23.toBounds2D()); assertEpsilonEquals(this.id11.toBounds2D(), this.id11.toBounds2D()); assertEpsilonEquals(this.id12.toBounds2D(), this.id11.toBounds2D()); assertNotEquals(this.id13.toBounds2D(), this.id11.toBounds2D()); assertNotEquals(this.id21.toBounds2D(), this.id11.toBounds2D()); assertNotEquals(this.id22.toBounds2D(), this.id11.toBounds2D()); assertNotEquals(this.id23.toBounds2D(), this.id11.toBounds2D()); assertEpsilonEquals(this.id11.toBounds2D(), this.id12.toBounds2D()); assertEpsilonEquals(this.id12.toBounds2D(), this.id12.toBounds2D()); assertNotEquals(this.id13.toBounds2D(), this.id12.toBounds2D()); assertNotEquals(this.id21.toBounds2D(), this.id12.toBounds2D()); assertNotEquals(this.id22.toBounds2D(), this.id12.toBounds2D()); assertNotEquals(this.id23.toBounds2D(), this.id12.toBounds2D()); assertNotEquals(this.id11.toBounds2D(), this.id13.toBounds2D()); assertNotEquals(this.id12.toBounds2D(), this.id13.toBounds2D()); assertEpsilonEquals(this.id13.toBounds2D(), this.id13.toBounds2D()); assertNotEquals(this.id21.toBounds2D(), this.id13.toBounds2D()); assertNotEquals(this.id22.toBounds2D(), this.id13.toBounds2D()); assertNotEquals(this.id23.toBounds2D(), this.id13.toBounds2D()); assertNotEquals(this.id11.toBounds2D(), this.id21.toBounds2D()); assertNotEquals(this.id12.toBounds2D(), this.id21.toBounds2D()); assertNotEquals(this.id13.toBounds2D(), this.id21.toBounds2D()); assertEpsilonEquals(this.id21.toBounds2D(), this.id21.toBounds2D()); assertEpsilonEquals(this.id22.toBounds2D(), this.id21.toBounds2D()); assertNotEquals(this.id23.toBounds2D(), this.id21.toBounds2D()); assertNotEquals(this.id11.toBounds2D(), this.id22.toBounds2D()); assertNotEquals(this.id12.toBounds2D(), this.id22.toBounds2D()); assertNotEquals(this.id13.toBounds2D(), this.id22.toBounds2D()); assertEpsilonEquals(this.id21.toBounds2D(), this.id22.toBounds2D()); assertEpsilonEquals(this.id22.toBounds2D(), this.id22.toBounds2D()); assertNotEquals(this.id23.toBounds2D(), this.id22.toBounds2D()); assertNotEquals(this.id11.toBounds2D(), this.id23.toBounds2D()); assertNotEquals(this.id12.toBounds2D(), this.id23.toBounds2D()); assertNotEquals(this.id13.toBounds2D(), this.id23.toBounds2D()); assertNotEquals(this.id21.toBounds2D(), this.id23.toBounds2D()); assertNotEquals(this.id22.toBounds2D(), this.id23.toBounds2D()); assertEpsilonEquals(this.id23.toBounds2D(), this.id23.toBounds2D()); }