Java 类org.jfree.data.xy.DefaultIntervalXYDataset 实例源码

项目:parabuild-ci    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Some checks for the getItemCount() method.
 */
public void testGetItemCount() {
    DefaultIntervalXYDataset d = createSampleDataset1();
    assertEquals(3, d.getItemCount(0));
    assertEquals(3, d.getItemCount(1));

    // try an index out of bounds
    boolean pass = false;
    try {
        d.getItemCount(2);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Creates a sample dataset for testing.
 * 
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start, 
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start, 
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:ccu-historian    文件:XYBarRendererTest.java   
/**
 * A simple test for the findRangeBounds() method.
 */
@Test
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:ccu-historian    文件:ClusteredXYBarRendererTest.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that the standard method has 'includeInterval'
 * defaulting to true.
 */
@Test
public void testFindDomainBounds2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that when the 'includeInterval' flag is false, the
 * bounds come from the regular x-values.
 */
@Test
public void testFindDomainBounds3() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that NaN values are ignored.
 */
@Test
public void testFindDomainBounds_NaN() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, Double.NaN};
    double[] x1Start = new double[] {0.9, 1.9, Double.NaN};
    double[] x1End = new double[] {1.1, 2.1, Double.NaN};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * Check that NaN values in the IntervalXYDataset are ignored.
 */
@Test
public void testIterateDomainBounds_NaN2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {Double.NaN, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, Double.NaN, 2.9};
    double[] x1End = new double[] {1.1, Double.NaN, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.iterateDomainBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateDomainBounds(dataset, true);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:XYBarRendererTest.java   
/**
 * A simple test for the findRangeBounds() method.
 */
@Test
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:ClusteredXYBarRendererTest.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that the standard method has 'includeInterval'
 * defaulting to true.
 */
@Test
public void testFindDomainBounds2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that when the 'includeInterval' flag is false, the
 * bounds come from the regular x-values.
 */
@Test
public void testFindDomainBounds3() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that the correct values are returned if the x and
 * y values fall outside the intervals.
 */
@Test
public void testFindDomainBounds4() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {0.8, 3.2, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.findDomainBounds(dataset);
    assertEquals(0.8, r.getLowerBound(), EPSILON);
    assertEquals(3.2, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that NaN values are ignored.
 */
@Test
public void testFindDomainBounds_NaN() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, Double.NaN};
    double[] x1Start = new double[] {0.9, 1.9, Double.NaN};
    double[] x1End = new double[] {1.1, 2.1, Double.NaN};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);

    r = DatasetUtils.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * Check that NaN values in the IntervalXYDataset are ignored.
 */
@Test
public void testIterateDomainBounds_NaN2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {Double.NaN, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, Double.NaN, 2.9};
    double[] x1End = new double[] {1.1, Double.NaN, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.iterateDomainBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    r = DatasetUtils.iterateDomainBounds(dataset, true);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that the correct values are returned if the x-values 
 * fall outside the intervals (it is not required that they do).
 */
@Test
public void testIterateToFindDomainBounds_IntervalXYDataset() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {0.8, 3.2, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.iterateToFindDomainBounds(dataset, 
            Arrays.asList("S1"), true);
    assertEquals(0.8, r.getLowerBound(), EPSILON);
    assertEquals(3.2, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * This test checks that the correct values are returned if the y-values
 * fall outside the intervals (it is not required that they do).
 */
@Test
public void testIterateToFindRangeBounds_IntervalXYDataset() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {0.8, 3.2, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, -5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtils.iterateToFindRangeBounds(dataset,
            Arrays.asList("S1"), new Range(0.0, 4.0), true);
    assertEquals(-5.0, r.getLowerBound(), EPSILON);
    assertEquals(6.0, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:XYBarRendererTest.java   
/**
 * A simple test for the findRangeBounds() method.
 */
@Test
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:ClusteredXYBarRendererTest.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that the standard method has 'includeInterval'
 * defaulting to true.
 */
@Test
public void testFindDomainBounds2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that when the 'includeInterval' flag is false, the
 * bounds come from the regular x-values.
 */
@Test
public void testFindDomainBounds3() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that NaN values are ignored.
 */
@Test
public void testFindDomainBounds_NaN() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, Double.NaN};
    double[] x1Start = new double[] {0.9, 1.9, Double.NaN};
    double[] x1End = new double[] {1.1, 2.1, Double.NaN};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * Check that NaN values in the IntervalXYDataset are ignored.
 */
@Test
public void testIterateDomainBounds_NaN2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {Double.NaN, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, Double.NaN, 2.9};
    double[] x1End = new double[] {1.1, Double.NaN, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.iterateDomainBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateDomainBounds(dataset, true);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:nabs    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Some checks for the getItemCount() method.
 */
public void testGetItemCount() {
    DefaultIntervalXYDataset d = createSampleDataset1();
    assertEquals(3, d.getItemCount(0));
    assertEquals(3, d.getItemCount(1));

    // try an index out of bounds
    boolean pass = false;
    try {
        d.getItemCount(2);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Creates a sample dataset for testing.
 * 
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start, 
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start, 
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:ECG-Viewer    文件:XYBarRendererTest.java   
/**
 * A simple test for the findRangeBounds() method.
 */
@Test
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:ECG-Viewer    文件:ClusteredXYBarRendererTest.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:ECG-Viewer    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that the standard method has 'includeInterval'
 * defaulting to true.
 */
@Test
public void testFindDomainBounds2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:ECG-Viewer    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that when the 'includeInterval' flag is false, the
 * bounds come from the regular x-values.
 */
@Test
public void testFindDomainBounds3() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
}
项目:ECG-Viewer    文件:DatasetUtilitiesTest.java   
/**
 * This test checks that NaN values are ignored.
 */
@Test
public void testFindDomainBounds_NaN() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, Double.NaN};
    double[] x1Start = new double[] {0.9, 1.9, Double.NaN};
    double[] x1End = new double[] {1.1, 2.1, Double.NaN};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:ECG-Viewer    文件:DatasetUtilitiesTest.java   
/**
 * Check that NaN values in the IntervalXYDataset are ignored.
 */
@Test
public void testIterateDomainBounds_NaN2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {Double.NaN, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, Double.NaN, 2.9};
    double[] x1End = new double[] {1.1, Double.NaN, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.iterateDomainBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateDomainBounds(dataset, true);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:astor    文件:XYBarRendererTests.java   
/**
 * A simple test for the findRangeBounds() method.
 */
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:astor    文件:ClusteredXYBarRendererTests.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:astor    文件:DatasetUtilitiesTests.java   
/**
 * This test checks that the standard method has 'includeInterval'
 * defaulting to true.
 */
public void testFindDomainBounds2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:astor    文件:DatasetUtilitiesTests.java   
/**
 * This test checks that when the 'includeInterval' flag is false, the
 * bounds come from the regular x-values.
 */
public void testFindDomainBounds3() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
}
项目:astor    文件:DatasetUtilitiesTests.java   
/**
 * This test checks that NaN values are ignored.
 */
public void testFindDomainBounds_NaN() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, Double.NaN};
    double[] x1Start = new double[] {0.9, 1.9, Double.NaN};
    double[] x1End = new double[] {1.1, 2.1, Double.NaN};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.findDomainBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(2.1, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findDomainBounds(dataset, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:astor    文件:DatasetUtilitiesTests.java   
/**
 * Check that NaN values in the IntervalXYDataset are ignored.
 */
public void testIterateDomainBounds_NaN2() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {Double.NaN, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, Double.NaN, 2.9};
    double[] x1End = new double[] {1.1, Double.NaN, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    dataset.addSeries("S1", data1);
    Range r = DatasetUtilities.iterateDomainBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    r = DatasetUtilities.iterateDomainBounds(dataset, true);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(3.1, r.getUpperBound(), EPSILON);
}
项目:astor    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Some checks for the getItemCount() method.
 */
public void testGetItemCount() {
    DefaultIntervalXYDataset d = createSampleDataset1();
    assertEquals(3, d.getItemCount(0));
    assertEquals(3, d.getItemCount(1));

    // try an index out of bounds
    boolean pass = false;
    try {
        d.getItemCount(2);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:DefaultIntervalXYDatasetTests.java   
/**
 * Creates a sample dataset for testing.
 *
 * @return A sample dataset.
 */
public DefaultIntervalXYDataset createSampleDataset1() {
    DefaultIntervalXYDataset d = new DefaultIntervalXYDataset();
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] x1Start = new double[] {0.9, 1.9, 2.9};
    double[] x1End = new double[] {1.1, 2.1, 3.1};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[] y1Start = new double[] {1.09, 2.09, 3.09};
    double[] y1End = new double[] {1.11, 2.11, 3.11};
    double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start,
            y1End};
    d.addSeries("S1", data1);

    double[] x2 = new double[] {11.0, 12.0, 13.0};
    double[] x2Start = new double[] {10.9, 11.9, 12.9};
    double[] x2End = new double[] {11.1, 12.1, 13.1};
    double[] y2 = new double[] {14.0, 15.0, 16.0};
    double[] y2Start = new double[] {11.09, 12.09, 13.09};
    double[] y2End = new double[] {11.11, 12.11, 13.11};
    double[][] data2 = new double[][] {x2, x2Start, x2End, y2, y2Start,
            y2End};
    d.addSeries("S2", data2);
    return d;
}
项目:group-five    文件:XYBarRendererTest.java   
/**
 * A simple test for the findRangeBounds() method.
 */
@Test
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}