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

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

Introduction

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

Prototype

public OHLC(double open, double high, double low, double close) 

Source Link

Document

Creates a new instance of OHLC.

Usage

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

/**
 * Confirm that the equals method can distinguish all the required fields.
 */// ww  w  . jav  a  2s . 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));
}

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

/**
 * Creates a new instance of <code>OHLCItem</code>.
 *
 * @param period  the time period.//from   w  ww .  j  a  v a 2 s .  co  m
 * @param open  the open-value.
 * @param high  the high-value.
 * @param low  the low-value.
 * @param close  the close-value.
 */
public OHLCItem(RegularTimePeriod period, double open, double high, double low, double close) {
    super(period, new OHLC(open, high, low, close));
}

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

/**
 * This class is immutable.//from   www  .  ja v  a2  s  .c  o m
 */
@Test
public void testCloning() {
    OHLC i1 = new OHLC(2.0, 4.0, 1.0, 3.0);
    assertFalse(i1 instanceof Cloneable);
}

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

/**
 * Serialize an instance, restore it, and check for equality.
 *///from w w w.j a v a  2s  .  c  o  m
@Test
public void testSerialization() {
    OHLC i1 = new OHLC(2.0, 4.0, 1.0, 3.0);
    OHLC i2 = (OHLC) TestUtilities.serialised(i1);
    assertEquals(i1, i2);
}

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

/**
 * Two objects that are equal are required to return the same hashCode.
 *///from  w  ww  .  j  a v a2  s  . 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);
}