本文整理汇总了Java中org.jfree.data.UnknownKeyException类的典型用法代码示例。如果您正苦于以下问题:Java UnknownKeyException类的具体用法?Java UnknownKeyException怎么用?Java UnknownKeyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnknownKeyException类属于org.jfree.data包,在下文中一共展示了UnknownKeyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRemoveValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Some tests for the removeValue() method.
*/
public void testRemoveValue() {
DefaultKeyedValues data = new DefaultKeyedValues();
data.addValue("A", new Double(1.0));
data.addValue("B", null);
data.addValue("C", new Double(3.0));
data.addValue("D", new Double(2.0));
assertEquals(1, data.getIndex("B"));
data.removeValue("B");
assertEquals(-1, data.getIndex("B"));
boolean pass = false;
try {
data.removeValue("XXX");
}
catch (UnknownKeyException e) {
pass = true;
}
assertTrue(pass);
}
示例2: testRemoveColumnByKey
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Some basic checks for the removeColumn(Comparable) method.
*/
public void testRemoveColumnByKey() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.addValue(new Double(1.0), "R1", "C1");
d.addValue(new Double(2.0), "R2", "C2");
d.removeColumn("C2");
d.addValue(new Double(3.0), "R2", "C2");
assertEquals(3.0, d.getValue("R2", "C2").doubleValue(), EPSILON);
// check for unknown column
boolean pass = false;
try {
d.removeColumn("XXX");
}
catch (UnknownKeyException e) {
pass = true;
}
assertTrue(pass);
}
示例3: getStartValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the start data value for one category in a series.
*
* @param series the required series.
* @param category the required category.
*
* @return The start data value for one category in a series
* (possibly <code>null</code>).
*
* @see #getStartValue(int, int)
*/
public Number getStartValue(Comparable series, Comparable category) {
int seriesIndex = getSeriesIndex(series);
if (seriesIndex < 0) {
throw new UnknownKeyException("Unknown 'series' key.");
}
int itemIndex = getColumnIndex(category);
if (itemIndex < 0) {
throw new UnknownKeyException("Unknown 'category' key.");
}
return getStartValue(seriesIndex, itemIndex);
}
示例4: getEndValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the end data value for one category in a series.
*
* @param series the required series.
* @param category the required category.
*
* @return The end data value for one category in a series (null possible).
*
* @see #getEndValue(int, int)
*/
public Number getEndValue(Comparable series, Comparable category) {
int seriesIndex = getSeriesIndex(series);
if (seriesIndex < 0) {
throw new UnknownKeyException("Unknown 'series' key.");
}
int itemIndex = getColumnIndex(category);
if (itemIndex < 0) {
throw new UnknownKeyException("Unknown 'category' key.");
}
return getEndValue(seriesIndex, itemIndex);
}
示例5: testRemove
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Some checks for the remove method.
*/
@Test
public void testRemove() {
DefaultBoxAndWhiskerCategoryDataset data
= new DefaultBoxAndWhiskerCategoryDataset();
boolean pass = false;
try {
data.remove("R1", "R2");
}
catch (UnknownKeyException e) {
pass = true;
}
assertTrue(pass);
data.add(new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
new ArrayList()), "R1", "C1");
assertEquals(new Range(7.0, 8.0), data.getRangeBounds(false));
assertEquals(new Range(7.0, 8.0), data.getRangeBounds(true));
data.add(new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
new ArrayList()), "R2", "C1");
assertEquals(new Range(7.0, 9.5), data.getRangeBounds(false));
assertEquals(new Range(7.0, 9.5), data.getRangeBounds(true));
data.remove("R1", "C1");
assertEquals(new Range(8.5, 9.5), data.getRangeBounds(false));
assertEquals(new Range(8.5, 9.5), data.getRangeBounds(true));
}
示例6: testRemove
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Some checks for the remove method.
*/
@Test
public void testRemove() {
DefaultStatisticalCategoryDataset data
= new DefaultStatisticalCategoryDataset();
boolean pass = false;
try {
data.remove("R1", "R2");
}
catch (UnknownKeyException e) {
pass = true;
}
assertTrue(pass);
data.add(1.0, 0.5, "R1", "C1");
assertEquals(new Range(1.0, 1.0), data.getRangeBounds(false));
assertEquals(new Range(0.5, 1.5), data.getRangeBounds(true));
data.add(1.4, 0.2, "R2", "C1");
assertEquals(1.0, data.getRangeLowerBound(false), EPSILON);
assertEquals(1.4, data.getRangeUpperBound(false), EPSILON);
assertEquals(0.5, data.getRangeLowerBound(true), EPSILON);
assertEquals(1.6, data.getRangeUpperBound(true), EPSILON);
data.remove("R1", "C1");
assertEquals(1.4, data.getRangeLowerBound(false), EPSILON);
assertEquals(1.4, data.getRangeUpperBound(false), EPSILON);
assertEquals(1.2, data.getRangeLowerBound(true), EPSILON);
assertEquals(1.6, data.getRangeUpperBound(true), EPSILON);
}
示例7: getValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the value for a pair of keys.
*
* @param rowKey the row key (<code>null</code> not permitted).
* @param columnKey the column key (<code>null</code> not permitted).
*
* @return The value (possibly <code>null</code>).
*
* @throws UnknownKeyException if either key is not defined in the dataset.
*/
@Override
public Number getValue(Comparable rowKey, Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getValue(r, c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例8: getPercentComplete
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the percent complete for a given item.
*
* @param rowKey the row key.
* @param columnKey the column key.
*
* @return The percent complete.
*/
@Override
public Number getPercentComplete(Comparable rowKey, Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getPercentComplete(r,
c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例9: getEndValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the end value of a sub-interval for a given item.
*
* @param rowKey the row key.
* @param columnKey the column key.
* @param subinterval the sub-interval.
*
* @return The end value (possibly <code>null</code>).
*
* @see #getStartValue(Comparable, Comparable, int)
*/
@Override
public Number getEndValue(Comparable rowKey, Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getEndValue(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例10: getStartValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the start value of a sub-interval for a given item.
*
* @param rowKey the row key.
* @param columnKey the column key.
* @param subinterval the sub-interval.
*
* @return The start value (possibly <code>null</code>).
*
* @see #getEndValue(Comparable, Comparable, int)
*/
@Override
public Number getStartValue(Comparable rowKey, Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getStartValue(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例11: getSubIntervalCount
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the number of sub-intervals for a given item.
*
* @param rowKey the row key.
* @param columnKey the column key.
*
* @return The sub-interval count.
*
* @see #getSubIntervalCount(int, int)
*/
@Override
public int getSubIntervalCount(Comparable rowKey, Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getSubIntervalCount(r,
c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例12: getStartValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the start data value for one category in a series.
*
* @param series the required series.
* @param category the required category.
*
* @return The start data value for one category in a series
* (possibly <code>null</code>).
*
* @see #getStartValue(int, int)
*/
@Override
public Number getStartValue(Comparable series, Comparable category) {
int seriesIndex = getSeriesIndex(series);
if (seriesIndex < 0) {
throw new UnknownKeyException("Unknown 'series' key.");
}
int itemIndex = getColumnIndex(category);
if (itemIndex < 0) {
throw new UnknownKeyException("Unknown 'category' key.");
}
return getStartValue(seriesIndex, itemIndex);
}
示例13: getEndValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the end data value for one category in a series.
*
* @param series the required series.
* @param category the required category.
*
* @return The end data value for one category in a series (null possible).
*
* @see #getEndValue(int, int)
*/
@Override
public Number getEndValue(Comparable series, Comparable category) {
int seriesIndex = getSeriesIndex(series);
if (seriesIndex < 0) {
throw new UnknownKeyException("Unknown 'series' key.");
}
int itemIndex = getColumnIndex(category);
if (itemIndex < 0) {
throw new UnknownKeyException("Unknown 'category' key.");
}
return getEndValue(seriesIndex, itemIndex);
}
示例14: getValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the value for a pair of keys.
*
* @param rowKey the row key ({@code null} not permitted).
* @param columnKey the column key ({@code null} not permitted).
*
* @return The value (possibly {@code null}).
*
* @throws UnknownKeyException if either key is not defined in the dataset.
*/
@Override
public Number getValue(Comparable rowKey, Comparable columnKey) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getValue(r, c + this.firstCategoryIndex);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}
示例15: getEndValue
import org.jfree.data.UnknownKeyException; //导入依赖的package包/类
/**
* Returns the end value of a sub-interval for a given item.
*
* @param rowKey the row key.
* @param columnKey the column key.
* @param subinterval the sub-interval.
*
* @return The end value (possibly {@code null}).
*
* @see #getStartValue(Comparable, Comparable, int)
*/
@Override
public Number getEndValue(Comparable rowKey, Comparable columnKey,
int subinterval) {
int r = getRowIndex(rowKey);
int c = getColumnIndex(columnKey);
if (c != -1) {
return this.underlying.getEndValue(r,
c + this.firstCategoryIndex, subinterval);
}
else {
throw new UnknownKeyException("Unknown columnKey: " + columnKey);
}
}