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

项目:parabuild-ci    文件:XIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * Some checks for the add() method for an UNSORTED series.
 */
public void testAdd() {
    XIntervalSeries series = new XIntervalSeries("Series", false, true);
    series.add(5.0, 5.50, 5.50, 5.50);
    series.add(5.1, 5.51, 5.51, 5.51);
    series.add(6.0, 6.6, 6.6, 6.6);
    series.add(3.0, 3.3, 3.3, 3.3);
    series.add(4.0, 4.4, 4.4, 4.4);
    series.add(2.0, 2.2, 2.2, 2.2);
    series.add(1.0, 1.1, 1.1, 1.1);
    assertEquals(5.5, series.getYValue(0), EPSILON);
    assertEquals(5.51, series.getYValue(1), EPSILON);
    assertEquals(6.6, series.getYValue(2), EPSILON);
    assertEquals(3.3, series.getYValue(3), EPSILON);
    assertEquals(4.4, series.getYValue(4), EPSILON);
    assertEquals(2.2, series.getYValue(5), EPSILON);
    assertEquals(1.1, series.getYValue(6), EPSILON);
}
项目:nabs    文件:XIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * Some checks for the add() method for an UNSORTED series.
 */
public void testAdd() {
    XIntervalSeries series = new XIntervalSeries("Series", false, true);
    series.add(5.0, 5.50, 5.50, 5.50);
    series.add(5.1, 5.51, 5.51, 5.51);
    series.add(6.0, 6.6, 6.6, 6.6);
    series.add(3.0, 3.3, 3.3, 3.3);
    series.add(4.0, 4.4, 4.4, 4.4);
    series.add(2.0, 2.2, 2.2, 2.2);
    series.add(1.0, 1.1, 1.1, 1.1);
    assertEquals(5.5, series.getYValue(0), EPSILON);
    assertEquals(5.51, series.getYValue(1), EPSILON);
    assertEquals(6.6, series.getYValue(2), EPSILON);
    assertEquals(3.3, series.getYValue(3), EPSILON);
    assertEquals(4.4, series.getYValue(4), EPSILON);
    assertEquals(2.2, series.getYValue(5), EPSILON);
    assertEquals(1.1, series.getYValue(6), EPSILON);
}
项目:astor    文件:XIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    XIntervalSeriesCollection c2 = new XIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    XIntervalSeries s1 = new XIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    XIntervalSeries s2 = new XIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new XIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new XIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * Some checks for the add() method for an UNSORTED series.
 */
public void testAdd() {
    XIntervalSeries series = new XIntervalSeries("Series", false, true);
    series.add(5.0, 5.50, 5.50, 5.50);
    series.add(5.1, 5.51, 5.51, 5.51);
    series.add(6.0, 6.6, 6.6, 6.6);
    series.add(3.0, 3.3, 3.3, 3.3);
    series.add(4.0, 4.4, 4.4, 4.4);
    series.add(2.0, 2.2, 2.2, 2.2);
    series.add(1.0, 1.1, 1.1, 1.1);
    assertEquals(5.5, series.getYValue(0), EPSILON);
    assertEquals(5.51, series.getYValue(1), EPSILON);
    assertEquals(6.6, series.getYValue(2), EPSILON);
    assertEquals(3.3, series.getYValue(3), EPSILON);
    assertEquals(4.4, series.getYValue(4), EPSILON);
    assertEquals(2.2, series.getYValue(5), EPSILON);
    assertEquals(1.1, series.getYValue(6), EPSILON);
}
项目:snap-desktop    文件:HistogramPanel.java   
private void setStx(Stx stx) {
    if (stx != null) {
        HistogramPanelModel.HistogramConfig config = createHistogramConfig();
        if (config == null) {
            return;
        }
        if (!model.hasStx(config)) {
            model.setStx(config, stx);
        }
        dataset = new XIntervalSeriesCollection();
        final int[] binCounts = stx.getHistogramBins();
        final RasterDataNode raster = getRaster();
        final XIntervalSeries series = new XIntervalSeries(raster.getName());
        final Histogram histogram = stx.getHistogram();
        for (int i = 0; i < binCounts.length; i++) {
            final double xMin = histogram.getBinLowValue(0, i);
            final double xMax = i < binCounts.length - 1 ?
                    histogram.getBinLowValue(0, i + 1) : histogram.getHighValue(0);
            series.add(xMin, xMin, xMax, binCounts[i]);
        }
        dataset.addSeries(series);
    }
    handleStxChange();
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the indexOf() method.
 */
public void testIndexOf() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 3.0);
    s1.add(3.0, 3.0, 3.0, 4.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * A check for the indexOf() method for an unsorted series.
 */
public void testIndexOf2() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1", false, true);
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));        
    assertEquals(1, s1.indexOf(new Double(3.0)));        
    assertEquals(2, s1.indexOf(new Double(2.0)));        
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the remove() method.
 */
public void testRemove() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    assertEquals(3, s1.getItemCount());

    s1.remove(new Double(2.0));
    assertEquals(new Double(3.0), s1.getX(1));

    s1.remove(new Double(1.0));
    assertEquals(new Double(3.0), s1.getX(0));    
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * When items are added with duplicate x-values, we expect them to remain 
 * in the order they were added.
 */
public void testAdditionOfDuplicateXValues() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 1.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(2.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 4.0, 4.0, 4.0);
    s1.add(3.0, 5.0, 5.0, 5.0);
    assertEquals(1.0, s1.getYValue(0), EPSILON);
    assertEquals(2.0, s1.getYValue(1), EPSILON);
    assertEquals(3.0, s1.getYValue(2), EPSILON);
    assertEquals(4.0, s1.getYValue(3), EPSILON);
    assertEquals(5.0, s1.getYValue(4), EPSILON);
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * A simple check that the maximumItemCount attribute is working.
 */
public void testSetMaximumItemCount() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:parabuild-ci    文件:XIntervalSeriesTests.java   
/**
 * Check that the maximum item count can be applied retrospectively.
 */
public void testSetMaximumItemCount2() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    s1.setMaximumItemCount(2);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the indexOf() method.
 */
public void testIndexOf() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 3.0);
    s1.add(3.0, 3.0, 3.0, 4.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * A check for the indexOf() method for an unsorted series.
 */
public void testIndexOf2() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1", false, true);
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));        
    assertEquals(1, s1.indexOf(new Double(3.0)));        
    assertEquals(2, s1.indexOf(new Double(2.0)));        
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the remove() method.
 */
public void testRemove() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    assertEquals(3, s1.getItemCount());

    s1.remove(new Double(2.0));
    assertEquals(new Double(3.0), s1.getX(1));

    s1.remove(new Double(1.0));
    assertEquals(new Double(3.0), s1.getX(0));    
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * When items are added with duplicate x-values, we expect them to remain 
 * in the order they were added.
 */
public void testAdditionOfDuplicateXValues() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 1.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(2.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 4.0, 4.0, 4.0);
    s1.add(3.0, 5.0, 5.0, 5.0);
    assertEquals(1.0, s1.getYValue(0), EPSILON);
    assertEquals(2.0, s1.getYValue(1), EPSILON);
    assertEquals(3.0, s1.getYValue(2), EPSILON);
    assertEquals(4.0, s1.getYValue(3), EPSILON);
    assertEquals(5.0, s1.getYValue(4), EPSILON);
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * A simple check that the maximumItemCount attribute is working.
 */
public void testSetMaximumItemCount() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:nabs    文件:XIntervalSeriesTests.java   
/**
 * Check that the maximum item count can be applied retrospectively.
 */
public void testSetMaximumItemCount2() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    s1.setMaximumItemCount(2);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the indexOf() method.
 */
public void testIndexOf() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 3.0);
    s1.add(3.0, 3.0, 3.0, 4.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * A check for the indexOf() method for an unsorted series.
 */
public void testIndexOf2() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1", false, true);
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));
    assertEquals(1, s1.indexOf(new Double(3.0)));
    assertEquals(2, s1.indexOf(new Double(2.0)));
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * Simple test for the remove() method.
 */
public void testRemove() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    assertEquals(3, s1.getItemCount());

    s1.remove(new Double(2.0));
    assertEquals(new Double(3.0), s1.getX(1));

    s1.remove(new Double(1.0));
    assertEquals(new Double(3.0), s1.getX(0));
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * When items are added with duplicate x-values, we expect them to remain
 * in the order they were added.
 */
public void testAdditionOfDuplicateXValues() {
    XIntervalSeries s1 = new XIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 1.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(2.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 4.0, 4.0, 4.0);
    s1.add(3.0, 5.0, 5.0, 5.0);
    assertEquals(1.0, s1.getYValue(0), EPSILON);
    assertEquals(2.0, s1.getYValue(1), EPSILON);
    assertEquals(3.0, s1.getYValue(2), EPSILON);
    assertEquals(4.0, s1.getYValue(3), EPSILON);
    assertEquals(5.0, s1.getYValue(4), EPSILON);
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * A simple check that the maximumItemCount attribute is working.
 */
public void testSetMaximumItemCount() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * Check that the maximum item count can be applied retrospectively.
 */
public void testSetMaximumItemCount2() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    s1.setMaximumItemCount(2);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * Some checks for the clear() method.
 */
public void testClear() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.addChangeListener(this);
    s1.clear();
    assertNull(this.lastEvent);
    assertTrue(s1.isEmpty());
    s1.add(1.0, 2.0, 3.0, 4.0);
    assertFalse(s1.isEmpty());
    s1.clear();
    assertNotNull(this.lastEvent);
    assertTrue(s1.isEmpty());
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * A simple check for getXLowValue().
 */
public void testGetXLowValue() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.add(1.0, 2.0, 3.0, 4.0);
    assertEquals(2.0, s1.getXLowValue(0), EPSILON);
    s1.add(2.0, 1.0, 4.0, 2.5);
    assertEquals(1.0, s1.getXLowValue(1), EPSILON);
}
项目:astor    文件:XIntervalSeriesTests.java   
/**
 * A simple check for getXHighValue().
 */
public void testGetXHighValue() {
    XIntervalSeries s1 = new XIntervalSeries("S1");
    s1.add(1.0, 2.0, 3.0, 4.0);
    assertEquals(3.0, s1.getXHighValue(0), EPSILON);
    s1.add(2.0, 1.0, 4.0, 2.5);
    assertEquals(4.0, s1.getXHighValue(1), EPSILON);
}
项目:oceano    文件:MetricChartService.java   
private XIntervalSeriesCollection createHistogramDataSet(List<RevisionMetricValueDto> dataValues, int numberOfSets, double doubleHistogram[], boolean isDelta) {

        XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();
        XIntervalSeries series = new XIntervalSeries("Metric Values");
        int y[] = new int[numberOfSets + 1];
        int i;
        for (i = 0; i < (numberOfSets + 1); i++) {
            y[i] = 0;
        }
        double auxValue;
        for (RevisionMetricValueDto dataValue : dataValues) {
            if (isDelta) {

                auxValue = dataValue.getDeltaMetricValue();
            } else {
                auxValue = dataValue.getAbsoluteMetricValue();
            }
            if (!Double.isNaN(auxValue)) {
                i = this.getIndexOfHistogram(auxValue, numberOfSets, doubleHistogram);
                if (i >= 0) {
                    y[i] = y[i] + 1;
                }
            }

        }
        for (i = 0; i < (numberOfSets); i++) {
            series.add((doubleHistogram[i] + doubleHistogram[i + 1]) / 2, doubleHistogram[i], doubleHistogram[i + 1], y[i]);
        }
        dataset.addSeries(series);

        return dataset;
    }
项目:snap-desktop    文件:StatisticsPanel.java   
private static ChartPanel createChartPanel(XIntervalSeries percentileSeries, String xAxisLabel, String yAxisLabel, Color color) {
    XIntervalSeriesCollection percentileDataset = new XIntervalSeriesCollection();
    percentileDataset.addSeries(percentileSeries);
    return getHistogramPlotPanel(percentileDataset, xAxisLabel, yAxisLabel, color);
}