Example usage for org.jfree.data.xy XIntervalSeriesCollection XIntervalSeriesCollection

List of usage examples for org.jfree.data.xy XIntervalSeriesCollection XIntervalSeriesCollection

Introduction

In this page you can find the example usage for org.jfree.data.xy XIntervalSeriesCollection XIntervalSeriesCollection.

Prototype

public XIntervalSeriesCollection() 

Source Link

Document

Creates a new instance of XIntervalSeriesCollection.

Usage

From source file:org.jfree.chart.demo.XIntervalSeriesCollectionDemo1.java

private static IntervalXYDataset createDataset() {
    XIntervalSeriesCollection xintervalseriescollection = new XIntervalSeriesCollection();
    XIntervalSeries xintervalseries = new XIntervalSeries("S1");
    xintervalseriescollection.addSeries(xintervalseries);
    return xintervalseriescollection;
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///from w  w w  . j a  v  a2  s .  c  om
@Test
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Confirm that the equals method can distinguish all the required fields.
 *//*from   ww  w.j  a  v  a2  s . com*/
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Confirm that cloning works./*from  w  w  w. jav  a2 s .  c  om*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    XIntervalSeriesCollection c2 = (XIntervalSeriesCollection) c1.clone();
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    s1.setDescription("XYZ");
    assertFalse(c1.equals(c2));
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Confirm that cloning works./*from ww  w  .  j  av  a  2 s . c  o  m*/
 */
public void testCloning() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    XIntervalSeriesCollection c2 = null;
    try {
        c2 = (XIntervalSeriesCollection) 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));
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Verify that this class implements {@link PublicCloneable}.
 *///from  w  ww . j a v  a2 s. co  m
@Test
public void testPublicCloneable() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    assertTrue(c1 instanceof PublicCloneable);
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *//*from  ww  w  .  j a  va2 s.c  om*/
@Test
public void testSerialization() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    XIntervalSeriesCollection c2 = (XIntervalSeriesCollection) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}

From source file:org.jfree.data.xy.XIntervalSeriesCollectionTest.java

/**
 * Some basic checks for the removeSeries() method.
 */// w  w  w.  j a  v a 2s  .  co  m
@Test
public void testRemoveSeries() {
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("s1");
    c.addSeries(s1);
    c.removeSeries(0);
    assertEquals(0, c.getSeriesCount());
    c.addSeries(s1);

    boolean pass = false;
    try {
        c.removeSeries(-1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
        c.removeSeries(1);
    } catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Verify that this class implements {@link PublicCloneable}.
 *//*from www  .  ja  va2s.co m*/
public void testPublicCloneable() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    assertTrue(c1 instanceof PublicCloneable);
}

From source file:org.jfree.data.xy.junit.XIntervalSeriesCollectionTest.java

/**
 * Serialize an instance, restore it, and check for equality.
 *//*from  w  w w .j a  va2  s. co  m*/
public void testSerialization() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    XIntervalSeriesCollection c2 = null;

    try {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream(buffer);
        out.writeObject(c1);
        out.close();

        ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        c2 = (XIntervalSeriesCollection) in.readObject();
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    assertEquals(c1, c2);
}