Example usage for org.jfree.data.general DefaultKeyedValueDataset equals

List of usage examples for org.jfree.data.general DefaultKeyedValueDataset equals

Introduction

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

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this dataset for equality with an arbitrary object.

Usage

From source file:org.jfree.data.general.DefaultKeyedValueDatasetTest.java

/**
 * Confirm that the clone is independent of the original.
 *///ww  w  .j  av  a2  s. c  o m
@Test
public void testCloneIndependence() throws CloneNotSupportedException {
    DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Key", new Double(10.0));
    DefaultKeyedValueDataset d2 = (DefaultKeyedValueDataset) d1.clone();
    assertTrue(d1.equals(d2));
    d2.updateValue(new Double(99.9));
    assertFalse(d1.equals(d2));
    d2.updateValue(new Double(10.0));
    assertTrue(d1.equals(d2));
}

From source file:org.jfree.data.general.DefaultKeyedValueDatasetTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///w  w w  .  j  av  a2 s  .  c  om
@Test
public void testEquals() {

    DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    DefaultKeyedValueDataset d2 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));

    d1 = new DefaultKeyedValueDataset("Test 1", new Double(45.5));
    d2 = new DefaultKeyedValueDataset("Test 2", new Double(45.5));
    assertFalse(d1.equals(d2));

    d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    d2 = new DefaultKeyedValueDataset("Test", new Double(45.6));
    assertFalse(d1.equals(d2));

}

From source file:org.jfree.data.general.DefaultKeyedValueDatasetTest.java

/**
 * Confirm that cloning works.//from  w  w  w .ja  v  a 2 s .c o  m
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultKeyedValueDataset d1 = new DefaultKeyedValueDataset("Test", new Double(45.5));
    DefaultKeyedValueDataset d2 = (DefaultKeyedValueDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));
}