imglib/imglib — pull request #59 by ctrueden (2014-03-09 12:55:52+00:00)
Title: Make equals consistent with compareTo

From the javadoc of Comparable#compareTo:
> It is strongly recommended, but _not_ strictly required that `(x.compareTo(y)==0) == (x.equals(y))`. Generally speaking, any class that implements the `Comparable` interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

The `RealType` interface extends `Comparable`, and `AbstractRealType` overrides `compareTo`, but it did not override `equals` or `hashCode`. This commit updates the `AbstractRealType` class hierarchy to override `equals` and `hashCode` in the appropriate places, so that type equality is consistent with the results of the `compareTo` method.

Thanks to @MichaelZinsmaier for noticing this issue.