Java Code Examples for org.jfree.data.DataUtilities#createNumberArray2D()

The following examples show how to use org.jfree.data.DataUtilities#createNumberArray2D() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultIntervalCategoryDatasetTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@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));
}
 
Example 2
Source File: DefaultIntervalCategoryDatasetTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@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));
}
 
Example 3
Source File: DefaultIntervalCategoryDatasetTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@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));
}
 
Example 4
Source File: DefaultIntervalCategoryDatasetTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@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));
}
 
Example 5
Source File: DefaultIntervalCategoryDatasetTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@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));
}
 
Example 6
Source File: DataUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests the createNumberArray2D() method.
 */
public void testCreateNumberArray2D() {
    double[][] d = new double[2][];
    d[0] = new double[] {1.1, 2.2, 3.3, 4.4};
    d[1] = new double[] {1.1, 2.2, 3.3, 4.4, 5.5};
    Number[][] n = DataUtilities.createNumberArray2D(d);
    assertEquals(2, n.length);
    assertEquals(4, n[0].length);
    assertEquals(5, n[1].length);
}
 
Example 7
Source File: DataUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests the createNumberArray2D() method.
 */
public void testCreateNumberArray2D() {
    double[][] d = new double[2][];
    d[0] = new double[] {1.1, 2.2, 3.3, 4.4};
    d[1] = new double[] {1.1, 2.2, 3.3, 4.4, 5.5};
    Number[][] n = DataUtilities.createNumberArray2D(d);
    assertEquals(2, n.length);
    assertEquals(4, n[0].length);
    assertEquals(5, n[1].length);
}
 
Example 8
Source File: DefaultIntervalCategoryDataset.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 9
Source File: DefaultIntervalCategoryDataset.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 10
Source File: DefaultIntervalCategoryDataset.java    From opensim-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @param starts  the starting values for the intervals.
 * @param ends  the ending values for the intervals.
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 11
Source File: DefaultIntervalCategoryDataset.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 12
Source File: DefaultIntervalCategoryDataset.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 13
Source File: DefaultIntervalCategoryDataset.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 14
Source File: Chart_16_DefaultIntervalCategoryDataset_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 15
Source File: Chart_16_DefaultIntervalCategoryDataset_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 16
Source File: DefaultIntervalCategoryDataset.java    From SIMVA-SoS with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 17
Source File: DefaultIntervalCategoryDataset.java    From ccu-historian with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 18
Source File: 1_DefaultIntervalCategoryDataset.java    From SimFix with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}
 
Example 19
Source File: DefaultIntervalCategoryDataset.java    From openstock with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Creates a new dataset using the specified data values and automatically
 * generated series and category keys.
 *
 * @param starts  the starting values for the intervals (<code>null</code>
 *                not permitted).
 * @param ends  the ending values for the intervals (<code>null</code> not
 *                permitted).
 */
public DefaultIntervalCategoryDataset(double[][] starts, double[][] ends) {
    this(DataUtilities.createNumberArray2D(starts),
            DataUtilities.createNumberArray2D(ends));
}