S1Point implements Point<Sphere1D> { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other instanceof S1Point) { final S1Point rhs = (S1Point) other; if (rhs.isNaN()) { return this.isNaN(); } return alpha == rhs.alpha; } return false; } S1Point(final double alpha); private  S1Point(final double alpha, final Vector2D vector); double getAlpha(); Vector2D getVector(); Space getSpace(); boolean isNaN(); double distance(final Point<Sphere1D> point); static double distance(S1Point p1, S1Point p2); @Override boolean equals(Object other); @Override int hashCode(); static final S1Point NaN; }
@Test public void testEquals() { S1Point a = new S1Point(1.0); S1Point b = new S1Point(1.0); Assert.assertEquals(a.hashCode(), b.hashCode()); Assert.assertFalse(a == b); Assert.assertTrue(a.equals(b)); Assert.assertTrue(a.equals(a)); Assert.assertFalse(a.equals('a')); }