Java Code Examples for org.jfree.data.DomainOrder#DESCENDING

The following examples show how to use org.jfree.data.DomainOrder#DESCENDING . 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: RendererUtilitiesTest.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 2
Source File: RendererUtilitiesTest.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 3
Source File: RendererUtilitiesTest.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 4
Source File: RendererUtilitiesTest.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 5
Source File: RendererUtilitiesTest.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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 6
Source File: RendererUtilitiesTest.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * 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 7
Source File: RendererUtilitiesTest.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 8
Source File: RendererUtilitiesTest.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 9
Source File: RendererUtilitiesTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 10
Source File: RendererUtilitiesTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 11
Source File: RendererUtilitiesTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 12
Source File: RendererUtilitiesTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 13
Source File: RendererUtilitiesTest.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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));
}