Circle extends Geometry { public void setRadius(Double givenRadius) { Envelope centerGeometryMBR = this.centerGeometry.getEnvelopeInternal(); double width = centerGeometryMBR.getMaxX() - centerGeometryMBR.getMinX(); double length = centerGeometryMBR.getMaxY() - centerGeometryMBR.getMinY(); double centerGeometryInternalRadius = Math.sqrt(width * width + length * length) / 2; this.radius = givenRadius > centerGeometryInternalRadius ? givenRadius : centerGeometryInternalRadius; this.MBR = new Envelope(this.centerPoint.x - this.radius, this.centerPoint.x + this.radius, this.centerPoint.y - this.radius, this.centerPoint.y + this.radius); } Circle(Geometry centerGeometry, Double givenRadius); Geometry getCenterGeometry(); Coordinate getCenterPoint(); Double getRadius(); void setRadius(Double givenRadius); @Override boolean covers(Geometry other); @Override boolean intersects(Geometry other); @Override String getGeometryType(); @Override Coordinate getCoordinate(); @Override Coordinate[] getCoordinates(); @Override int getNumPoints(); @Override boolean isEmpty(); @Override int getDimension(); @Override Geometry getBoundary(); @Override int getBoundaryDimension(); @Override Geometry reverse(); @Override Object clone(); @Override boolean equalsExact(Geometry g, double tolerance); @Override void apply(CoordinateFilter filter); @Override void apply(CoordinateSequenceFilter filter); @Override void apply(GeometryFilter filter); @Override void apply(GeometryComponentFilter filter); @Override void normalize(); @Override String toString();  }
@Test public void testSetRadius() throws Exception { Circle circle = new Circle(makePoint(0.0, 0.0), 0.1); circle.setRadius(0.2); assertEquals(circle.getRadius(), 0.2, 0.01); }