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

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

Introduction

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

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this bin for equality with an arbitrary object.

Usage

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

/**
 * Ensure that the equals() method can distinguish all fields.
 *///  w  ww  .j a va  2 s .co m
@Test
public void testEquals() {
    SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0);
    SimpleHistogramBin b2 = new SimpleHistogramBin(1.0, 2.0);
    assertTrue(b1.equals(b2));
    assertTrue(b2.equals(b1));

    b1 = new SimpleHistogramBin(1.1, 2.0, true, true);
    assertFalse(b1.equals(b2));
    b2 = new SimpleHistogramBin(1.1, 2.0, true, true);
    assertTrue(b1.equals(b2));

    b1 = new SimpleHistogramBin(1.1, 2.2, true, true);
    assertFalse(b1.equals(b2));
    b2 = new SimpleHistogramBin(1.1, 2.2, true, true);
    assertTrue(b1.equals(b2));

    b1 = new SimpleHistogramBin(1.1, 2.2, false, true);
    assertFalse(b1.equals(b2));
    b2 = new SimpleHistogramBin(1.1, 2.2, false, true);
    assertTrue(b1.equals(b2));

    b1 = new SimpleHistogramBin(1.1, 2.2, false, false);
    assertFalse(b1.equals(b2));
    b2 = new SimpleHistogramBin(1.1, 2.2, false, false);
    assertTrue(b1.equals(b2));

    b1.setItemCount(99);
    assertFalse(b1.equals(b2));
    b2.setItemCount(99);
    assertTrue(b1.equals(b2));
}

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

/**
 * Some checks for the clone() method./*from  ww w .jav  a 2  s  .  co m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    SimpleHistogramBin b1 = new SimpleHistogramBin(1.1, 2.2, false, true);
    b1.setItemCount(99);
    SimpleHistogramBin b2 = (SimpleHistogramBin) b1.clone();
    assertTrue(b1 != b2);
    assertTrue(b1.getClass() == b2.getClass());
    assertTrue(b1.equals(b2));

    // check that clone is independent of the original
    b2.setItemCount(111);
    assertFalse(b1.equals(b2));
}