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