Example usage for org.jfree.data.category DefaultIntervalCategoryDataset getClass

List of usage examples for org.jfree.data.category DefaultIntervalCategoryDataset getClass

Introduction

In this page you can find the example usage for org.jfree.data.category DefaultIntervalCategoryDataset 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.category.DefaultIntervalCategoryDatasetTest.java

/**
 * A check to ensure that an empty dataset can be cloned.
 *///from w w  w  .ja  v a 2  s  .c o m
@Test
public void testCloning2() throws CloneNotSupportedException {
    DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(new double[0][0], new double[0][0]);
    DefaultIntervalCategoryDataset d2 = null;
    d2 = (DefaultIntervalCategoryDataset) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));
}

From source file:org.jfree.data.category.DefaultIntervalCategoryDatasetTest.java

/**
 * Confirm that cloning works./* w  w  w  . j  ava2s.  co  m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    double[] starts_S1 = new double[] { 0.1, 0.2, 0.3 };
    double[] starts_S2 = new double[] { 0.3, 0.4, 0.5 };
    double[] ends_S1 = new double[] { 0.5, 0.6, 0.7 };
    double[] ends_S2 = new double[] { 0.7, 0.8, 0.9 };
    double[][] starts = new double[][] { starts_S1, starts_S2 };
    double[][] ends = new double[][] { ends_S1, ends_S2 };
    DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(
            new Comparable[] { "Series 1", "Series 2" },
            new Comparable[] { "Category 1", "Category 2", "Category 3" },
            DataUtilities.createNumberArray2D(starts), DataUtilities.createNumberArray2D(ends));
    DefaultIntervalCategoryDataset d2 = null;
    d2 = (DefaultIntervalCategoryDataset) 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.
    d1.setStartValue(0, "Category 1", new Double(0.99));
    assertFalse(d1.equals(d2));
    d2.setStartValue(0, "Category 1", new Double(0.99));
    assertTrue(d1.equals(d2));
}