本文整理汇总了Java中org.jfree.data.DomainOrder.DESCENDING属性的典型用法代码示例。如果您正苦于以下问题:Java DomainOrder.DESCENDING属性的具体用法?Java DomainOrder.DESCENDING怎么用?Java DomainOrder.DESCENDING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.data.DomainOrder
的用法示例。
在下文中一共展示了DomainOrder.DESCENDING属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindLiveItemsLowerBound_Descending
/**
* 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));
}
示例2: testFindLiveItemsUpperBound_Descending
/**
* 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));
}
示例3: testFindLiveItemsLowerBound_Descending
/**
* 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, RendererUtils.findLiveItemsLowerBound(d, 0, 10.0,
11.0));
// check a series with one item
d.addSeries("S2", new double[][] {{1.0}, {9.9}});
assertEquals(0, RendererUtils.findLiveItemsLowerBound(d, 1, 0.0,
1.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsLowerBound(d, 2, 0.1,
0.5));
assertEquals(1, RendererUtils.findLiveItemsLowerBound(d, 2, 0.1,
1.0));
assertEquals(0, RendererUtils.findLiveItemsLowerBound(d, 2, 1.1,
2.0));
assertEquals(0, RendererUtils.findLiveItemsLowerBound(d, 2, 2.2,
3.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsLowerBound(d, 3, 0.0,
1.0));
assertEquals(1, RendererUtils.findLiveItemsLowerBound(d, 3, 1.0,
2.0));
assertEquals(0, RendererUtils.findLiveItemsLowerBound(d, 3, 2.0,
3.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsLowerBound(d, 4, 0.1,
0.5));
assertEquals(3, RendererUtils.findLiveItemsLowerBound(d, 4, 0.1,
1.0));
assertEquals(2, RendererUtils.findLiveItemsLowerBound(d, 4, 1.1,
2.0));
assertEquals(1, RendererUtils.findLiveItemsLowerBound(d, 4, 2.2,
3.0));
assertEquals(0, RendererUtils.findLiveItemsLowerBound(d, 4, 3.3,
4.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsLowerBound(d, 5, 0.0,
3.0));
assertEquals(1, RendererUtils.findLiveItemsLowerBound(d, 5, 0.0,
2.0));
assertEquals(4, RendererUtils.findLiveItemsLowerBound(d, 5, 0.0,
1.0));
assertEquals(4, RendererUtils.findLiveItemsLowerBound(d, 5, 0.0,
0.5));
}
示例4: testFindLiveItemsUpperBound_Descending
/**
* 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, RendererUtils.findLiveItemsUpperBound(d, 0, 10.0,
11.0));
// check a series with one item
d.addSeries("S2", new double[][] {{1.0}, {9.9}});
assertEquals(0, RendererUtils.findLiveItemsUpperBound(d, 1, 0.0,
1.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsUpperBound(d, 2, 0.1,
0.5));
assertEquals(1, RendererUtils.findLiveItemsUpperBound(d, 2, 0.1,
1.0));
assertEquals(0, RendererUtils.findLiveItemsUpperBound(d, 2, 1.1,
2.0));
assertEquals(0, RendererUtils.findLiveItemsUpperBound(d, 2, 2.2,
3.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsUpperBound(d, 3, 0.0,
1.0));
assertEquals(2, RendererUtils.findLiveItemsUpperBound(d, 3, 1.0,
2.0));
assertEquals(1, RendererUtils.findLiveItemsUpperBound(d, 3, 2.0,
3.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsUpperBound(d, 4, 0.1,
0.5));
assertEquals(3, RendererUtils.findLiveItemsUpperBound(d, 4, 0.1,
1.0));
assertEquals(2, RendererUtils.findLiveItemsUpperBound(d, 4, 1.1,
2.0));
assertEquals(1, RendererUtils.findLiveItemsUpperBound(d, 4, 2.2,
3.0));
assertEquals(0, RendererUtils.findLiveItemsUpperBound(d, 4, 3.3,
4.0));
assertEquals(0, RendererUtils.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, RendererUtils.findLiveItemsUpperBound(d, 5, 0.0,
5.0));
assertEquals(4, RendererUtils.findLiveItemsUpperBound(d, 5, 1.0,
5.0));
assertEquals(3, RendererUtils.findLiveItemsUpperBound(d, 5, 2.0,
5.0));
assertEquals(0, RendererUtils.findLiveItemsUpperBound(d, 5, 3.0,
5.0));
}
示例5: testFindLiveItemsLowerBound_Descending
/**
* 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));
}
示例6: testFindLiveItemsUpperBound_Descending
/**
* 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));
}
示例7: testFindLiveItemsLowerBound_Descending
/**
* Some checks for the findLiveItemsLowerBound() method when the dataset is
* DESCENDING.
*/
@Test
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));
}
示例8: testFindLiveItemsUpperBound_Descending
/**
* Some checks for the findLiveItemsUpperBound() method when the dataset is
* DESCENDING.
*/
@Test
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));
}