Example usage for org.jfree.data.xy XYCoordinate equals

List of usage examples for org.jfree.data.xy XYCoordinate equals

Introduction

In this page you can find the example usage for org.jfree.data.xy XYCoordinate equals.

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this coordinate for equality with an arbitrary object.

Usage

From source file:org.jfree.data.xy.XYCoordinateTest.java

/**
 * Two objects that are equal are required to return the same hashCode.
 *///  ww w  .j a v a2s .c  o  m
@Test
public void testHashcode() {
    XYCoordinate v1 = new XYCoordinate(1.0, 2.0);
    XYCoordinate v2 = new XYCoordinate(1.0, 2.0);
    assertTrue(v1.equals(v2));
    int h1 = v1.hashCode();
    int h2 = v2.hashCode();
    assertEquals(h1, h2);
}

From source file:org.jfree.data.xy.XYCoordinateTest.java

/**
 * Test that the equals() method distinguishes all fields.
 *//*from  w  ww .  java 2  s  .  c o  m*/
@Test
public void testEquals() {
    // default instances
    XYCoordinate v1 = new XYCoordinate(1.0, 2.0);
    XYCoordinate v2 = new XYCoordinate(1.0, 2.0);
    assertTrue(v1.equals(v2));
    assertTrue(v2.equals(v1));

    v1 = new XYCoordinate(1.1, 2.0);
    assertFalse(v1.equals(v2));
    v2 = new XYCoordinate(1.1, 2.0);
    assertTrue(v1.equals(v2));

    v1 = new XYCoordinate(1.1, 2.2);
    assertFalse(v1.equals(v2));
    v2 = new XYCoordinate(1.1, 2.2);
    assertTrue(v1.equals(v2));
}