Example usage for org.jfree.data.xy XYIntervalSeriesCollection clone

List of usage examples for org.jfree.data.xy XYIntervalSeriesCollection clone

Introduction

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

Prototype

@Override
public Object clone() throws CloneNotSupportedException 

Source Link

Document

Returns a clone of this dataset.

Usage

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

/**
 * Confirm that cloning works./*from   w w  w  . ja v  a 2  s . c o m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
    XYIntervalSeries s1 = new XYIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
    XYIntervalSeriesCollection c2 = (XYIntervalSeriesCollection) c1.clone();
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    c1.addSeries(new XYIntervalSeries("Empty"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XYIntervalSeries("Empty"));
    assertTrue(c1.equals(c2));
}

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

/**
 * Confirm that cloning works.//from  w w  w  . j  av a2s .  c o  m
 */
public void testCloning() {
    XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection();
    XYIntervalSeries s1 = new XYIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5);
    XYIntervalSeriesCollection c2 = null;
    try {
        c2 = (XYIntervalSeriesCollection) c1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(c1 != c2);
    assertTrue(c1.getClass() == c2.getClass());
    assertTrue(c1.equals(c2));

    // check independence
    c1.addSeries(new XYIntervalSeries("Empty"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XYIntervalSeries("Empty"));
    assertTrue(c1.equals(c2));
}