org.jfree.data.DomainOrder Java Examples
The following examples show how to use
org.jfree.data.DomainOrder.
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: DomainOrderTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the equals() method. */ public void testEquals() { assertEquals(DomainOrder.NONE, DomainOrder.NONE); assertEquals(DomainOrder.ASCENDING, DomainOrder.ASCENDING); assertEquals(DomainOrder.DESCENDING, DomainOrder.DESCENDING); assertFalse(DomainOrder.NONE.equals(DomainOrder.ASCENDING)); assertFalse(DomainOrder.NONE.equals(DomainOrder.DESCENDING)); assertFalse(DomainOrder.NONE.equals(null)); assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.NONE)); assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.DESCENDING)); assertFalse(DomainOrder.ASCENDING.equals(null)); assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.NONE)); assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.ASCENDING)); assertFalse(DomainOrder.DESCENDING.equals(null)); }
Example #2
Source File: XYSeriesCollection.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ @Override public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #3
Source File: XYSeriesCollection.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ @Override public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #4
Source File: XYSeriesCollection.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ @Override public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #5
Source File: XYSeriesCollection.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ @Override public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #6
Source File: XYSeriesCollection.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ @Override public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #7
Source File: DomainOrderTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the equals() method. */ public void testEquals() { assertEquals(DomainOrder.NONE, DomainOrder.NONE); assertEquals(DomainOrder.ASCENDING, DomainOrder.ASCENDING); assertEquals(DomainOrder.DESCENDING, DomainOrder.DESCENDING); assertFalse(DomainOrder.NONE.equals(DomainOrder.ASCENDING)); assertFalse(DomainOrder.NONE.equals(DomainOrder.DESCENDING)); assertFalse(DomainOrder.NONE.equals(null)); assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.NONE)); assertFalse(DomainOrder.ASCENDING.equals(DomainOrder.DESCENDING)); assertFalse(DomainOrder.ASCENDING.equals(null)); assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.NONE)); assertFalse(DomainOrder.DESCENDING.equals(DomainOrder.ASCENDING)); assertFalse(DomainOrder.DESCENDING.equals(null)); }
Example #8
Source File: XYSeriesCollection.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns the order of the domain (X) values, if this is known. * * @return The domain order. */ public DomainOrder getDomainOrder() { int seriesCount = getSeriesCount(); for (int i = 0; i < seriesCount; i++) { XYSeries s = getSeries(i); if (!s.getAutoSort()) { return DomainOrder.NONE; // we can't be sure of the order } } return DomainOrder.ASCENDING; }
Example #9
Source File: DomainOrderTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { DomainOrder d1 = DomainOrder.ASCENDING; DomainOrder d2 = DomainOrder.ASCENDING; assertTrue(d1.equals(d2)); int h1 = d1.hashCode(); int h2 = d2.hashCode(); assertEquals(h1, h2); }
Example #10
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * DESCENDING. */ public void testFindLiveItemsUpperBoundDescending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {2.0, 2.0, 2.0}}); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.4, 5.0)); }
Example #11
Source File: IntensityPlotDataset.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public DomainOrder getDomainOrder() { return DomainOrder.ASCENDING; }
Example #12
Source File: RendererUtilitiesTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsLowerBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 4.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 4.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.0)); }
Example #13
Source File: RendererUtilitiesTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * DESCENDING. */ @Test public void testFindLiveItemsLowerBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 3.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 1.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 0.5)); }
Example #14
Source File: RendererUtilitiesTest.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * DESCENDING. */ @Test public void testFindLiveItemsUpperBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 0.0, 5.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 1.0, 5.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 5, 2.0, 5.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 5, 3.0, 5.0)); }
Example #15
Source File: RendererUtilitiesTest.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #16
Source File: RendererUtilitiesTest.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsLowerBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 4.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 4.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.0)); }
Example #17
Source File: RendererUtilitiesTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #18
Source File: RendererUtilitiesTest.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * DESCENDING. */ @Test public void testFindLiveItemsLowerBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 3.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 1.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 0.5)); }
Example #19
Source File: RendererUtilitiesTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #20
Source File: RendererUtilitiesTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * DESCENDING. */ @Test public void testFindLiveItemsUpperBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 0.0, 5.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 1.0, 5.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 5, 2.0, 5.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 5, 3.0, 5.0)); }
Example #21
Source File: RendererUtilitiesTest.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #22
Source File: RendererUtilitiesTest.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ @Test public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { @Override public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #23
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ public void testFindLiveItemsUpperBoundAscending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {2.0, 2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); }
Example #24
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * DESCENDING. */ public void testFindLiveItemsLowerBoundDescending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 0.5)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {2.0, 2.0, 2.0}}); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 0.5)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.4, 5.0)); }
Example #25
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * ASCENDING. */ public void testFindLiveItemsLowerBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 4.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 4.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.0)); }
Example #26
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * DESCENDING. */ public void testFindLiveItemsLowerBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 3.0)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 1.0)); assertEquals(4, RendererUtilities.findLiveItemsLowerBound(d, 5, 0.0, 0.5)); }
Example #27
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * ASCENDING. */ public void testFindLiveItemsUpperBound_Ascending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.0, 1.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.0, 2.2)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.3)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.1)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.0, 2.2)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.0, 3.3)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.0, 4.4)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.0, 5.5)); // check a series with repeating items d.addSeries("S5", new double[][] {{1.0, 2.0, 2.0, 2.0, 3.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 1.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 2.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 3.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.0, 4.0)); }
Example #28
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsLowerBound() method when the dataset is * ASCENDING. */ public void testFindLiveItemsLowerBoundAscending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in ascending order by x-value return DomainOrder.ASCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 0, 10.0, 11.1)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 1, 2.0, 2.2)); // check a series with two items d.addSeries("S3", new double[][] {{1.0, 2.0}, {2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 2, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 2, 3.0, 4.4)); // check a series with three items d.addSeries("S4", new double[][] {{1.0, 2.0, 3.0}, {2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 3, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 3, 3.0, 4.4)); // check a series with four items d.addSeries("S5", new double[][] {{1.0, 2.0, 3.0, 4.0}, {2.0, 2.0, 2.0, 2.0}}); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 0.0, 1.1)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 1.0, 2.2)); assertEquals(0, RendererUtilities.findLiveItemsLowerBound(d, 4, 2.0, 3.3)); assertEquals(1, RendererUtilities.findLiveItemsLowerBound(d, 4, 3.0, 4.4)); assertEquals(2, RendererUtilities.findLiveItemsLowerBound(d, 4, 4.0, 5.5)); }
Example #29
Source File: RendererUtilitiesTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some checks for the findLiveItemsUpperBound() method when the dataset is * DESCENDING. */ public void testFindLiveItemsUpperBound_Descending() { DefaultXYDataset d = new DefaultXYDataset() { public DomainOrder getDomainOrder() { // we're doing this for testing only, and make sure that we // only add data in descending order by x-value return DomainOrder.DESCENDING; } }; // check a series with no items d.addSeries("S1", new double[][] {{}, {}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 0, 10.0, 11.0)); // check a series with one item d.addSeries("S2", new double[][] {{1.0}, {9.9}}); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 0.0, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 1, 1.1, 2.0)); // check a series with two items d.addSeries("S3", new double[][] {{2.0, 1.0}, {9.9, 9.9}}); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 0.5)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 2, 0.1, 1.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 1.1, 2.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 2, 3.3, 4.0)); // check a series with three items d.addSeries("S4", new double[][] {{3.0, 2.0, 1.0}, {9.9, 9.9, 9.9}}); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 0.0, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 3, 1.0, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 3, 2.0, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 3, 3.0, 4.0)); // check a series with four items d.addSeries("S5", new double[][] {{4.0, 3.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9}}); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 0.5)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 4, 0.1, 1.0)); assertEquals(2, RendererUtilities.findLiveItemsUpperBound(d, 4, 1.1, 2.0)); assertEquals(1, RendererUtilities.findLiveItemsUpperBound(d, 4, 2.2, 3.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 3.3, 4.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 4, 4.4, 5.0)); // check a series with repeating items d.addSeries("S6", new double[][] {{3.0, 2.0, 2.0, 2.0, 1.0}, {9.9, 9.9, 9.9, 9.9, 9.9}}); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 0.0, 5.0)); assertEquals(4, RendererUtilities.findLiveItemsUpperBound(d, 5, 1.0, 5.0)); assertEquals(3, RendererUtilities.findLiveItemsUpperBound(d, 5, 2.0, 5.0)); assertEquals(0, RendererUtilities.findLiveItemsUpperBound(d, 5, 3.0, 5.0)); }
Example #30
Source File: DefaultXYZDataset.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the order of the domain (x-) values in the dataset. In this * implementation, we cannot guarantee that the x-values are ordered, so * this method returns <code>DomainOrder.NONE</code>. * * @return <code>DomainOrder.NONE</code>. */ public DomainOrder getDomainOrder() { return DomainOrder.NONE; }