Example usage for org.jfree.data.statistics SimpleHistogramDataset equals

List of usage examples for org.jfree.data.statistics SimpleHistogramDataset equals

Introduction

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

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Compares the dataset for equality with an arbitrary object.

Usage

From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java

/**
 * Ensure that the equals() method can distinguish all fields.
 *//*ww  w .  j a  va 2 s. c o m*/
@Test
public void testEquals() {
    SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1");
    SimpleHistogramDataset d2 = new SimpleHistogramDataset("Dataset 1");
    assertTrue(d1.equals(d2));

    d1.addBin(new SimpleHistogramBin(1.0, 2.0));
    assertFalse(d1.equals(d2));
    d2.addBin(new SimpleHistogramBin(1.0, 2.0));
    assertTrue(d1.equals(d2));
}

From source file:org.jfree.data.statistics.SimpleHistogramDatasetTest.java

/**
 * Some checks for the clone() method.//w  w  w.  j  a  v a 2s  .  c  om
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1");
    SimpleHistogramDataset d2 = (SimpleHistogramDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that clone is independent of the original
    d2.addBin(new SimpleHistogramBin(2.0, 3.0));
    d2.addObservation(2.3);
    assertFalse(d1.equals(d2));
}