List of usage examples for org.jfree.data.xy YIntervalSeriesCollection clone
@Override public Object clone() throws CloneNotSupportedException
From source file:org.jfree.data.xy.YIntervalSeriesCollectionTest.java
/** * Confirm that cloning works.//from ww w .java2 s .c o m */ @Test public void testCloning() throws CloneNotSupportedException { YIntervalSeriesCollection c1 = new YIntervalSeriesCollection(); YIntervalSeries s1 = new YIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); c1.addSeries(s1); YIntervalSeriesCollection c2 = (YIntervalSeriesCollection) 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.YIntervalSeriesCollectionTest.java
/** * Confirm that cloning works./*from w w w . jav a 2s . c o m*/ */ public void testCloning() { YIntervalSeriesCollection c1 = new YIntervalSeriesCollection(); YIntervalSeries s1 = new YIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); c1.addSeries(s1); YIntervalSeriesCollection c2 = null; try { c2 = (YIntervalSeriesCollection) 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)); }