freenet/fred-staging — pull request #230 by bertm (2014-05-22 12:55:29+00:00)
Title: Rewrite of the Location class

The purpose of this proposed changeset is to a) fix some minor bugs and b) make the code more readable / maintainable.

This fixes bugs:
* Location.equals(0.0, 1.0) returned false
* Location.distance(invalidLoc, invalidLoc, true) did not return 0.0

Further changes:
* Reuse change() (e.g. simpleDistance() is just abs(change()))
* Reuse isValid() instead of explicit bounds checks
* Simplify change()
* Simplify normalize()
* Use LOCATION_INVALID (= -1.0) instead of magic numbers
* Add just a bit more documentation