Example usage for org.jfree.data DefaultKeyedValues2D equals

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

Introduction

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

Prototype

@Override
public boolean equals(Object o) 

Source Link

Document

Tests if this object is equal to another.

Usage

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

/**
 * Some checks for the equals() method.//from ww w . j  a  va2 s.  co  m
 */
@Test
public void testEquals() {
    DefaultKeyedValues2D d1 = new DefaultKeyedValues2D();
    DefaultKeyedValues2D d2 = new DefaultKeyedValues2D();
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));

    d1.addValue(new Double(1.0), new Double(2.0), "S1");
    assertFalse(d1.equals(d2));
    d2.addValue(new Double(1.0), new Double(2.0), "S1");
    assertTrue(d1.equals(d2));
}

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

/**
 * Some checks for the clone() method./*from  w ww  . j  av  a2  s  .c o  m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultKeyedValues2D v1 = new DefaultKeyedValues2D();
    v1.setValue(new Integer(1), "V1", "C1");
    v1.setValue(null, "V2", "C1");
    v1.setValue(new Integer(3), "V3", "C2");
    DefaultKeyedValues2D v2 = (DefaultKeyedValues2D) v1.clone();
    assertTrue(v1 != v2);
    assertTrue(v1.getClass() == v2.getClass());
    assertTrue(v1.equals(v2));

    // check that clone is independent of the original
    v2.setValue(new Integer(2), "V2", "C1");
    assertFalse(v1.equals(v2));
}