org.jfree.data.category.DefaultIntervalCategoryDataset Java Examples

The following examples show how to use org.jfree.data.category.DefaultIntervalCategoryDataset. 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: IntervalBarRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3}, 
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset 
            = new DefaultIntervalCategoryDataset(starts, ends);        
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #2
Source File: IntervalBarRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
                = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #3
Source File: IntervalBarRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
                = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #4
Source File: IntervalBarRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
                = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #5
Source File: IntervalBarRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
                = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #6
Source File: IntervalBarRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
            = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #7
Source File: DatasetUtilitiesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #8
Source File: IntervalBarRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
@Test
public void testDrawWithNullInfo() {
    try {
        double[][] starts = new double[][] {{0.1, 0.2, 0.3},
                {0.3, 0.4, 0.5}};
        double[][] ends = new double[][] {{0.5, 0.6, 0.7}, {0.7, 0.8, 0.9}};
        DefaultIntervalCategoryDataset dataset
                = new DefaultIntervalCategoryDataset(starts, ends);
        IntervalBarRenderer renderer = new IntervalBarRenderer();
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                renderer);
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
    }
    catch (NullPointerException e) {
        fail("No exception should be thrown.");
    }
}
 
Example #9
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the setCategoryKeys() method.
 */
public void testSetCategoryKeys() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	boolean pass = true;
	try {
		empty.setCategoryKeys(new String[0]);
	}
	catch (RuntimeException e) {
		pass = false;
	}
	assertTrue(pass);
}
 
Example #10
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the getRowCount() method.
 */
public void testGetRowAndColumnCount() {
    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 d 
            = new DefaultIntervalCategoryDataset(starts, ends);        

    assertEquals(2, d.getRowCount());
    assertEquals(3, d.getColumnCount());
}
 
Example #11
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    double[] starts_S1A = new double[] {0.1, 0.2, 0.3};
    double[] starts_S2A = new double[] {0.3, 0.4, 0.5};
    double[] ends_S1A = new double[] {0.5, 0.6, 0.7};
    double[] ends_S2A = new double[] {0.7, 0.8, 0.9};
    double[][] startsA = new double[][] {starts_S1A, starts_S2A};
    double[][] endsA = new double[][] {ends_S1A, ends_S2A};
    DefaultIntervalCategoryDataset dA 
            = new DefaultIntervalCategoryDataset(startsA, endsA);        

    double[] starts_S1B = new double[] {0.1, 0.2, 0.3};
    double[] starts_S2B = new double[] {0.3, 0.4, 0.5};
    double[] ends_S1B = new double[] {0.5, 0.6, 0.7};
    double[] ends_S2B = new double[] {0.7, 0.8, 0.9};
    double[][] startsB = new double[][] {starts_S1B, starts_S2B};
    double[][] endsB = new double[][] {ends_S1B, ends_S2B};
    DefaultIntervalCategoryDataset dB 
            = new DefaultIntervalCategoryDataset(startsB, endsB);        
        
    assertTrue(dA.equals(dB));
    assertTrue(dB.equals(dA));
    
    // check that two empty datasets are equal
	DefaultIntervalCategoryDataset empty1 
            = new DefaultIntervalCategoryDataset(new double[0][0], 
    		        new double[0][0]);
	DefaultIntervalCategoryDataset empty2 
            = new DefaultIntervalCategoryDataset(new double[0][0], 
              new double[0][0]);
	assertTrue(empty1.equals(empty2));
}
 
Example #12
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getSeriesCount() method.
 */
public void testGetSeriesCount() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(0, empty.getSeriesCount());
}
 
Example #13
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getCategoryCount() method.
 */
public void testGetCategoryCount() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(0, empty.getCategoryCount());
}
 
Example #14
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getSeriesIndex() method.
 */
public void testGetSeriesIndex() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(-1, empty.getSeriesIndex("ABC"));
}
 
Example #15
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getRowIndex() method.
 */
public void testGetRowIndex() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(-1, empty.getRowIndex("ABC"));
}
 
Example #16
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the setSeriesKeys() method.
 */
public void testSetSeriesKeys() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	boolean pass = true;
	try {
		empty.setSeriesKeys(new String[0]);
	}
	catch (RuntimeException e) {
		pass = false;
	}
	assertTrue(pass);
}
 
Example #17
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getCategoryIndex() method.
 */
public void testGetCategoryIndex() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(-1, empty.getCategoryIndex("ABC"));
}
 
Example #18
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getColumnIndex() method.
 */
public void testGetColumnIndex() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
	assertEquals(-1, empty.getColumnIndex("ABC"));
}
 
Example #19
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getColumnKeys() method.
 */
public void testGetColumnKeys() {
    // check an empty dataset
    DefaultIntervalCategoryDataset empty
            = new DefaultIntervalCategoryDataset(new double[0][0],
                    new double[0][0]);
    List keys = empty.getColumnKeys();
    assertEquals(0, keys.size());
}
 
Example #20
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getColumnKeys() method.
 */
public void testGetColumnKeys() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
    List keys = empty.getColumnKeys();
    assertEquals(0, keys.size());
}
 
Example #21
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getRowKeys() method.
 */
public void testGetRowKeys() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
    List keys = empty.getRowKeys();
    assertEquals(0, keys.size());
}
 
Example #22
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getColumnCount() method.
 */
public void testGetColumnCount() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
    assertEquals(0, empty.getColumnCount());
}
 
Example #23
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getRowCount() method.
 */
public void testGetRowCount() {
	// check an empty dataset
	DefaultIntervalCategoryDataset empty 
	        = new DefaultIntervalCategoryDataset(new double[0][0], 
	        		new double[0][0]);
    assertEquals(0, empty.getColumnCount());
}
 
Example #24
Source File: DatasetUtilitiesTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
@Test
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #25
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getSeriesIndex() method.
 */
public void testGetSeriesIndex() {
    // check an empty dataset
    DefaultIntervalCategoryDataset empty
            = new DefaultIntervalCategoryDataset(new double[0][0],
                    new double[0][0]);
    assertEquals(-1, empty.getSeriesIndex("ABC"));
}
 
Example #26
Source File: DatasetUtilitiesTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
@Test
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #27
Source File: DatasetUtilitiesTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
@Test
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #28
Source File: DatasetUtilitiesTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
@Test
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #29
Source File: DatasetUtilitiesTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the iterateRangeBounds() method using an
 * IntervalCategoryDataset.
 */
@Test
public void testIterateRangeBounds3_CategoryDataset() {
    Number[][] starts = new Double[2][3];
    Number[][] ends = new Double[2][3];
    starts[0][0] = new Double(1.0);
    starts[0][1] = new Double(2.0);
    starts[0][2] = new Double(3.0);
    starts[1][0] = new Double(11.0);
    starts[1][1] = new Double(12.0);
    starts[1][2] = new Double(13.0);
    ends[0][0] = new Double(4.0);
    ends[0][1] = new Double(5.0);
    ends[0][2] = new Double(6.0);
    ends[1][0] = new Double(16.0);
    ends[1][1] = new Double(15.0);
    ends[1][2] = new Double(14.0);

    DefaultIntervalCategoryDataset d = new DefaultIntervalCategoryDataset(
            starts, ends);
    Range r = DatasetUtilities.iterateRangeBounds(d, false);
    assertEquals(4.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(16.0, r.getUpperBound(), EPSILON);
}
 
Example #30
Source File: DefaultIntervalCategoryDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the getRowCount() method.
 */
public void testGetRowAndColumnCount() {
    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 d
            = new DefaultIntervalCategoryDataset(starts, ends);

    assertEquals(2, d.getRowCount());
    assertEquals(3, d.getColumnCount());
}