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

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

Introduction

In this page you can find the example usage for org.jfree.data.xy MatrixSeriesCollection 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.MatrixSeriesCollectionTest.java

/**
 * Confirm that cloning works./*from w ww. j av a  2  s  .  c o  m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = (MatrixSeriesCollection) 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.MatrixSeriesCollectionTest.java

/**
 * Confirm that cloning works.//from   w  w w  . j ava2  s  .  co m
 */
public void testCloning() {
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    s1.update(0, 0, 1.1);
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    c1.addSeries(s1);
    MatrixSeriesCollection c2 = null;
    try {
        c2 = (MatrixSeriesCollection) 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));
}