spatial4j
spatial4j copied to clipboard
Remove AbstractDistanceCalculator and simplify distance method
AbstractDistanceCalculator doesn't add anything except redirecting distance(Point, Point) to distance(Point, double, double).
Now that we have reusable Points, we should remove distance(Point, double, double) and just keep distance(Point, Point) (it reads alot better) and remove AbstractDistanceCalculator
AbstractDistanceCalculator indeed isn't doing much so I support removing it.
Despite shapes being re-usable, it doesn't mean that all API call sites are in a position to possess a re-usable Shape. For example, take RectangleImpl.getCenter():Point It has no point to re-use, and adding one to the method parameter seems very wrong to me. Another example regarding the specific method you pointed out is to look at who calls it. CircleImpl.contains() calls it, and it has no re-usable shape parameter. Lets say it had one... now who calls this method? CircleImpl.relate(Point) does. And where is this method to get a re-usable Point from?