Example usage for org.jfree.data KeyedObjects2D equals

List of usage examples for org.jfree.data KeyedObjects2D equals

Introduction

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

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this object for equality with an arbitrary object.

Usage

From source file:org.jfree.data.KeyedObjects2DTest.java

/**
 * Some checks for the equals() method./*from   www  . j  ava2 s  .  c o m*/
 */
@Test
public void testEquals() {
    KeyedObjects2D k1 = new KeyedObjects2D();
    KeyedObjects2D k2 = new KeyedObjects2D();
    assertTrue(k1.equals(k2));
    assertTrue(k2.equals(k1));

    k1.addObject(new Integer(99), "R1", "C1");
    assertFalse(k1.equals(k2));
    k2.addObject(new Integer(99), "R1", "C1");
    assertTrue(k1.equals(k2));
}

From source file:org.jfree.data.KeyedObjects2DTest.java

/**
 * Confirm that cloning works.//  w w  w. j  a va  2 s .  c  om
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    KeyedObjects2D o1 = new KeyedObjects2D();
    o1.setObject(new Integer(1), "V1", "C1");
    o1.setObject(null, "V2", "C1");
    o1.setObject(new Integer(3), "V3", "C2");
    KeyedObjects2D o2 = (KeyedObjects2D) o1.clone();
    assertTrue(o1 != o2);
    assertTrue(o1.getClass() == o2.getClass());
    assertTrue(o1.equals(o2));

    // check independence
    o1.addObject("XX", "R1", "C1");
    assertFalse(o1.equals(o2));
}