Example usage for org.jfree.data.xy DefaultXYZDataset getClass

List of usage examples for org.jfree.data.xy DefaultXYZDataset getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

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

/**
 * Confirm that cloning works.//  www .  j  a va  2s .co m
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultXYZDataset d1 = new DefaultXYZDataset();
    DefaultXYZDataset d2 = (DefaultXYZDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // try a dataset with some content...
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[] z1 = new double[] { 7.0, 8.0, 9.0 };
    double[][] data1 = new double[][] { x1, y1, z1 };
    d1.addSeries("S1", data1);
    d2 = (DefaultXYZDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that the clone doesn't share the same underlying arrays.
    x1[1] = 2.2;
    assertFalse(d1.equals(d2));
    x1[1] = 2.0;
    assertTrue(d1.equals(d2));
}

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

/**
 * Confirm that cloning works.//from w ww.j a va  2  s . com
 */
public void testCloning() {
    DefaultXYZDataset d1 = new DefaultXYZDataset();
    DefaultXYZDataset d2 = null;
    try {
        d2 = (DefaultXYZDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // try a dataset with some content...
    double[] x1 = new double[] { 1.0, 2.0, 3.0 };
    double[] y1 = new double[] { 4.0, 5.0, 6.0 };
    double[] z1 = new double[] { 7.0, 8.0, 9.0 };
    double[][] data1 = new double[][] { x1, y1, z1 };
    d1.addSeries("S1", data1);
    try {
        d2 = (DefaultXYZDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that the clone doesn't share the same underlying arrays.
    x1[1] = 2.2;
    assertFalse(d1.equals(d2));
    x1[1] = 2.0;
    assertTrue(d1.equals(d2));
}