Examples of OHLCSeries


Examples of org.jfree.data.time.ohlc.OHLCSeries

   
    /**
     * Check that the maximum item count can be applied retrospectively.
     */
    public void testSetMaximumItemCount2() {
        OHLCSeries s1 = new OHLCSeries("s1");
        s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1);
        s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2);
        s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3);
        s1.setMaximumItemCount(2);
        assertEquals(new Year(2007), s1.getPeriod(0));
        assertEquals(new Year(2008), s1.getPeriod(1));
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

   
    /**
     * Some checks for the clear() method.
     */
    public void testClear() {
      OHLCSeries s1 = new OHLCSeries("S1");
        s1.addChangeListener(this);
        s1.clear();
        assertNull(this.lastEvent);
        assertTrue(s1.isEmpty());
        s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1);
        assertFalse(s1.isEmpty());
        s1.clear();
        assertNotNull(this.lastEvent);
        assertTrue(s1.isEmpty());
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

        OHLCSeriesCollection c1 = new OHLCSeriesCollection();
        OHLCSeriesCollection c2 = new OHLCSeriesCollection();
        assertEquals(c1, c2);
       
        // add a series
        OHLCSeries s1 = new OHLCSeries("Series");
        s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
        c1.addSeries(s1);
        assertFalse(c1.equals(c2));
        OHLCSeries s2 = new OHLCSeries("Series");
        s2.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
        c2.addSeries(s2);
        assertTrue(c1.equals(c2));
       
        // add an empty series
        c1.addSeries(new OHLCSeries("Empty Series"));
        assertFalse(c1.equals(c2));
        c2.addSeries(new OHLCSeries("Empty Series"));
        assertTrue(c1.equals(c2));
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        OHLCSeriesCollection c1 = new OHLCSeriesCollection();
        OHLCSeries s1 = new OHLCSeries("Series");
        s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
        c1.addSeries(s1);
        OHLCSeriesCollection c2 = null;
        try {
            c2 = (OHLCSeriesCollection) c1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(c1 != c2);
        assertTrue(c1.getClass() == c2.getClass());
        assertTrue(c1.equals(c2));
       
        // check independence
        s1.setDescription("XYZ");
        assertFalse(c1.equals(c2));
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        OHLCSeriesCollection c1 = new OHLCSeriesCollection();
        OHLCSeries s1 = new OHLCSeries("Series");
        s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
        c1.addSeries(s1);
        OHLCSeriesCollection c2 = null;
       
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * A test for bug report 1170825 (originally affected XYSeriesCollection,
     * this test is just copied over).
     */
    public void test1170825() {
        OHLCSeries s1 = new OHLCSeries("Series1");
        OHLCSeriesCollection dataset = new OHLCSeriesCollection();
        dataset.addSeries(s1);
        try {
            /* XYSeries s = */ dataset.getSeries(1);
        }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        OHLCSeries s1 = new OHLCSeries("s1");
        OHLCSeries s2 = new OHLCSeries("s1");
        assertTrue(s1.equals(s2));
       
        // seriesKey
        s1 = new OHLCSeries("s2");
        assertFalse(s1.equals(s2));
        s2 = new OHLCSeries("s2");
        assertTrue(s1.equals(s2));
       
        // add a value
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
        assertFalse(s1.equals(s2));
        s2.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
        assertTrue(s2.equals(s1));

        // add another value
        s1.add(new Year(2008), 2.0, 4.0, 1.0, 3.0);
        assertFalse(s1.equals(s2));
        s2.add(new Year(2008), 2.0, 4.0, 1.0, 3.0);
        assertTrue(s2.equals(s1));

        // remove a value
        s1.remove(new Year(2008));
        assertFalse(s1.equals(s2));
        s2.remove(new Year(2008));
        assertTrue(s2.equals(s1));
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        OHLCSeries s1 = new OHLCSeries("s1");
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
        OHLCSeries s2 = null;
        try {
            s2 = (OHLCSeries) s1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(s1 != s2);
        assertTrue(s1.getClass() == s2.getClass());
        assertTrue(s1.equals(s2));
    }
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        OHLCSeries s1 = new OHLCSeries("s1");
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
        OHLCSeries s2 = null;
       
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(s1);
View Full Code Here

Examples of org.jfree.data.time.ohlc.OHLCSeries

   
    /**
     * Simple test for the indexOf() method.
     */
    public void testIndexOf() {
        OHLCSeries s1 = new OHLCSeries("s1");
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
        s1.add(new Year(2011), 2.0, 4.0, 1.0, 3.0);
        s1.add(new Year(2010), 2.0, 4.0, 1.0, 3.0);
        assertEquals(0, s1.indexOf(new Year(2006)));
        assertEquals(1, s1.indexOf(new Year(2010)));
        assertEquals(2, s1.indexOf(new Year(2011)));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.