/** * 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 Cartesian && equalsType((Cartesian) obj); }
/** * 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 ==(Cartesian,Cartesian)'") public static boolean equals(@Nonnull Cartesian left, @Nonnull Cartesian right) { return left.equalsType(right); }
/** * 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 !=(Cartesian,Cartesian)'") public static boolean notEquals(@Nonnull Cartesian left, @Nonnull Cartesian right) { return !left.equalsType(right); }
/** * Tests math operators */ @Test public final void testMathOperatorsWithCartesian() { Matrix3By3 test = new Matrix3By3(1.0, 2.0, 4.0, 2.0, 3.0, 5.0, 4.0, 5.0, 6.0); Cartesian mult = new Cartesian(1D, 2D, 3D); Assert.assertTrue((new Cartesian(17D, 23D, 32D).equalsType(test.multiply(mult)))); Assert.assertTrue((new Cartesian(17D, 23D, 32D).equalsType(Matrix3By3.multiply(test, mult)))); }
Assert.assertFalse(Cartesian.notEquals(first, second)); Assert.assertFalse(Cartesian.notEquals(second, first)); Assert.assertTrue(first.equalsType(second)); Assert.assertTrue(second.equalsType(first)); second = new Cartesian(0.0, 2.0, 3.0); AssertHelper.assertNotEqual(first, second); Assert.assertTrue(Cartesian.notEquals(first, second)); Assert.assertTrue(Cartesian.notEquals(second, first)); Assert.assertFalse(first.equalsType(second)); Assert.assertFalse(second.equalsType(first)); second = new Cartesian(1.0, 0.0, 3.0); AssertHelper.assertNotEqual(first, second); Assert.assertTrue(Cartesian.notEquals(first, second)); Assert.assertTrue(Cartesian.notEquals(second, first)); Assert.assertFalse(first.equalsType(second)); Assert.assertFalse(second.equalsType(first)); second = new Cartesian(1.0, 2.0, 0.0); AssertHelper.assertNotEqual(first, second); Assert.assertTrue(Cartesian.notEquals(first, second)); Assert.assertTrue(Cartesian.notEquals(second, first)); Assert.assertFalse(first.equalsType(second)); Assert.assertFalse(second.equalsType(first));