本文整理汇总了Java中org.jfree.data.DomainOrder类的典型用法代码示例。如果您正苦于以下问题:Java DomainOrder类的具体用法?Java DomainOrder怎么用?Java DomainOrder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DomainOrder类属于org.jfree.data包,在下文中一共展示了DomainOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例2: testHashCode
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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);
}
示例3: getDomainOrder
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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;
}
示例4: getDomainOrder
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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;
}
示例5: testHashCode
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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);
}
示例6: testFindLiveItemsLowerBound_Ascending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例7: testFindLiveItemsLowerBound_Descending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例8: testFindLiveItemsUpperBound_Ascending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例9: testFindLiveItemsUpperBound_Descending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例10: testFindLiveItemsLowerBound_Ascending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例11: testFindLiveItemsLowerBound_Descending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例12: testFindLiveItemsUpperBound_Ascending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例13: testFindLiveItemsUpperBound_Descending
import org.jfree.data.DomainOrder; //导入依赖的package包/类
/**
* 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));
}
示例14: getDomainOrder
import org.jfree.data.DomainOrder; //导入依赖的package包/类
public DomainOrder getDomainOrder() {
return DomainOrder.NONE;
}
示例15: getDomainOrder
import org.jfree.data.DomainOrder; //导入依赖的package包/类
@Override
public DomainOrder getDomainOrder() {
return DomainOrder.NONE;
}