/** * Indicates whether another object is exactly equal to this instance. * @param obj The object to compare to this instance. * @return {@code true} if {@code obj} is an instance of this type and represents the same value as this instance; otherwise, {@code false}. */ @Override public boolean equals(Object obj) { return obj instanceof Cartographic && equalsType((Cartographic) obj); }
/** * Returns {@code true} if the two instances are not exactly equal. * @param left The instance to compare to {@code right}. * @param right The instance to compare to {@code left}. * @return {@code true} if {@code left} does not represent the same value as {@code right}; otherwise, {@code false}. */ @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean !=(Cartographic,Cartographic)'") public static boolean notEquals(@Nonnull Cartographic left, @Nonnull Cartographic right) { return !left.equalsType(right); }
/** * Returns {@code true} if the two instances are exactly equal. * @param left The instance to compare to {@code right}. * @param right The instance to compare to {@code left}. * @return {@code true} if {@code left} represents the same value as {@code right}; otherwise, {@code false}. */ @CS2JInfo("This method implements the functionality of the overloaded operator: 'System.Boolean ==(Cartographic,Cartographic)'") public static boolean equals(@Nonnull Cartographic left, @Nonnull Cartographic right) { return left.equalsType(right); }
/** * Tests the equality and inequality methods and operators. */ @Test public final void testEquality() { Cartographic first = new Cartographic(1.0, 2.0, 3.0); Cartographic second = new Cartographic(1.0, 2.0, 3.0); AssertHelper.assertEquals(first, second); AssertHelper.assertEquals(second, first); Assert.assertTrue(Cartographic.equals(first, second)); Assert.assertTrue(Cartographic.equals(second, first)); Assert.assertFalse(Cartographic.notEquals(first, second)); Assert.assertFalse(Cartographic.notEquals(second, first)); Assert.assertTrue(first.equalsType(second)); Assert.assertTrue(second.equalsType(first)); second = new Cartographic(1.0, 2.1, 3.0); AssertHelper.assertNotEqual(first, second); AssertHelper.assertNotEqual(second, first); Assert.assertFalse(Cartographic.equals(first, second)); Assert.assertFalse(Cartographic.equals(second, first)); Assert.assertTrue(Cartographic.notEquals(first, second)); Assert.assertTrue(Cartographic.notEquals(second, first)); Assert.assertFalse(first.equalsType(second)); Assert.assertFalse(second.equalsType(first)); }