Example usage for org.jfree.data.time.ohlc OHLC equals

List of usage examples for org.jfree.data.time.ohlc OHLC equals

Introduction

In this page you can find the example usage for org.jfree.data.time.ohlc OHLC equals.

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests this instance for equality with an arbitrary object.

Usage

From source file:org.jfree.data.time.ohlc.OHLCTest.java

/**
 * Two objects that are equal are required to return the same hashCode.
 *///from w  w  w .  j  av  a2s.  c  o  m
@Test
public void testHashcode() {
    OHLC i1 = new OHLC(2.0, 4.0, 1.0, 3.0);
    OHLC i2 = new OHLC(2.0, 4.0, 1.0, 3.0);
    assertTrue(i1.equals(i2));
    int h1 = i1.hashCode();
    int h2 = i2.hashCode();
    assertEquals(h1, h2);
}

From source file:org.jfree.data.time.ohlc.OHLCTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*www.  j av  a2  s  .c  o m*/
@Test
public void testEquals() {
    OHLC i1 = new OHLC(2.0, 4.0, 1.0, 3.0);
    OHLC i2 = new OHLC(2.0, 4.0, 1.0, 3.0);
    assertEquals(i1, i2);

    i1 = new OHLC(2.2, 4.0, 1.0, 3.0);
    assertFalse(i1.equals(i2));
    i2 = new OHLC(2.2, 4.0, 1.0, 3.0);
    assertTrue(i1.equals(i2));

    i1 = new OHLC(2.2, 4.4, 1.0, 3.0);
    assertFalse(i1.equals(i2));
    i2 = new OHLC(2.2, 4.4, 1.0, 3.0);
    assertTrue(i1.equals(i2));

    i1 = new OHLC(2.2, 4.4, 1.1, 3.0);
    assertFalse(i1.equals(i2));
    i2 = new OHLC(2.2, 4.4, 1.1, 3.0);
    assertTrue(i1.equals(i2));

    i1 = new OHLC(2.2, 4.4, 1.1, 3.3);
    assertFalse(i1.equals(i2));
    i2 = new OHLC(2.2, 4.4, 1.1, 3.3);
    assertTrue(i1.equals(i2));
}