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

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

Introduction

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

Prototype

@Override
public Object clone() throws CloneNotSupportedException 

Source Link

Document

Returns a clone of this instance.

Usage

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

/**
 * Confirm that cloning works.//from   w  w w .  j  a  v  a  2  s.  com
 */
@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./*  w  w  w .  j  av  a2  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));
}