本文整理汇总了Java中org.jfree.data.DefaultKeyedValues2D.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultKeyedValues2D.addValue方法的具体用法?Java DefaultKeyedValues2D.addValue怎么用?Java DefaultKeyedValues2D.addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.DefaultKeyedValues2D
的用法示例。
在下文中一共展示了DefaultKeyedValues2D.addValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetColumnKey
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some basic checks for the getColumnKey() method.
*/
public void testGetColumnKey() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
boolean pass = false;
try {
d.getColumnKey(0);
}
catch (IndexOutOfBoundsException e) {
pass = true;
}
assertTrue(pass);
d.addValue(new Double(1.0), "R1", "C1");
d.addValue(new Double(1.0), "R1", "C2");
assertEquals("C1", d.getColumnKey(0));
assertEquals("C2", d.getColumnKey(1));
}
示例2: testRemoveColumnByKey
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的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: testEquals
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the equals() method.
*/
public void testEquals() {
DefaultKeyedValues2D d1 = new DefaultKeyedValues2D();
DefaultKeyedValues2D d2 = new DefaultKeyedValues2D();
assertTrue(d1.equals(d2));
assertTrue(d2.equals(d1));
d1.addValue(new Double(1.0), new Double(2.0), "S1");
assertFalse(d1.equals(d2));
d2.addValue(new Double(1.0), new Double(2.0), "S1");
assertTrue(d1.equals(d2));
}
示例4: testSparsePopulation
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Populates a data structure with sparse entries, then checks that
* the unspecified entries return null.
*/
public void testSparsePopulation() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.addValue(new Integer(11), "R1", "C1");
d.addValue(new Integer(22), "R2", "C2");
assertEquals(new Integer(11), d.getValue("R1", "C1"));
assertNull(d.getValue("R1", "C2"));
assertEquals(new Integer(22), d.getValue("R2", "C2"));
assertNull(d.getValue("R2", "C1"));
}
示例5: testRowCount
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some basic checks for the getRowCount() method.
*/
public void testRowCount() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
assertEquals(0, d.getRowCount());
d.addValue(new Double(1.0), "R1", "C1");
assertEquals(1, d.getRowCount());
d.addValue(new Double(2.0), "R2", "C1");
assertEquals(2, d.getRowCount());
}
示例6: testColumnCount
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some basic checks for the getColumnCount() method.
*/
public void testColumnCount() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
assertEquals(0, d.getColumnCount());
d.addValue(new Double(1.0), "R1", "C1");
assertEquals(1, d.getColumnCount());
d.addValue(new Double(2.0), "R1", "C2");
assertEquals(2, d.getColumnCount());
}
示例7: testRemoveValue
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some basic checks for the removeValue() method.
*/
public void testRemoveValue() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.removeValue("R1", "C1");
d.addValue(new Double(1.0), "R1", "C1");
d.removeValue("R1", "C1");
assertEquals(0, d.getRowCount());
assertEquals(0, d.getColumnCount());
d.addValue(new Double(1.0), "R1", "C1");
d.addValue(new Double(2.0), "R2", "C1");
d.removeValue("R1", "C1");
assertEquals(new Double(2.0), d.getValue(0, 0));
}
示例8: testCalculateColumnTotal
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the calculateColumnTotal() method.
*/
public void testCalculateColumnTotal() {
DefaultKeyedValues2D table = new DefaultKeyedValues2D();
table.addValue(new Double(1.0), "R0", "C0");
table.addValue(new Double(2.0), "R0", "C1");
table.addValue(new Double(3.0), "R1", "C0");
table.addValue(new Double(4.0), "R1", "C1");
assertEquals(4.0, DataUtilities.calculateColumnTotal(table, 0), EPSILON);
assertEquals(6.0, DataUtilities.calculateColumnTotal(table, 1), EPSILON);
table.setValue(null, "R1", "C1");
assertEquals(2.0, DataUtilities.calculateColumnTotal(table, 1), EPSILON);
}
示例9: testCalculateRowTotal
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the calculateRowTotal() method.
*/
public void testCalculateRowTotal() {
DefaultKeyedValues2D table = new DefaultKeyedValues2D();
table.addValue(new Double(1.0), "R0", "C0");
table.addValue(new Double(2.0), "R0", "C1");
table.addValue(new Double(3.0), "R1", "C0");
table.addValue(new Double(4.0), "R1", "C1");
assertEquals(3.0, DataUtilities.calculateRowTotal(table, 0), EPSILON);
assertEquals(7.0, DataUtilities.calculateRowTotal(table, 1), EPSILON);
table.setValue(null, "R1", "C1");
assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1), EPSILON);
}
示例10: testEquals
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the equals() method.
*/
public void testEquals() {
DefaultKeyedValues2D d1 = new DefaultKeyedValues2D();
DefaultKeyedValues2D d2 = new DefaultKeyedValues2D();
assertTrue(d1.equals(d2));
assertTrue(d2.equals(d1));
d1.addValue(new Double(1.0), new Double(2.0), "S1");
assertFalse(d1.equals(d2));
d2.addValue(new Double(1.0), new Double(2.0), "S1");
assertTrue(d1.equals(d2));
}
示例11: testSparsePopulation
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Populates a data structure with sparse entries, then checks that
* the unspecified entries return null.
*/
public void testSparsePopulation() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.addValue(new Integer(11), "R1", "C1");
d.addValue(new Integer(22), "R2", "C2");
assertEquals(new Integer(11), d.getValue("R1", "C1"));
assertNull(d.getValue("R1", "C2"));
assertEquals(new Integer(22), d.getValue("R2", "C2"));
assertNull(d.getValue("R2", "C1"));
}
示例12: testRemoveValue
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some basic checks for the removeValue() method.
*/
public void testRemoveValue() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.removeValue("R1", "C1");
d.addValue(new Double(1.0), "R1", "C1");
d.removeValue("R1", "C1");
assertEquals(0, d.getRowCount());
assertEquals(0, d.getColumnCount());
d.addValue(new Double(1.0), "R1", "C1");
d.addValue(new Double(2.0), "R2", "C1");
d.removeValue("R1", "C1");
assertEquals(new Double(2.0), d.getValue(0, 0));
}
示例13: testRemoveValueBug1690654
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* A test for bug 1690654.
*/
public void testRemoveValueBug1690654() {
DefaultKeyedValues2D d = new DefaultKeyedValues2D();
d.addValue(new Double(1.0), "R1", "C1");
d.addValue(new Double(2.0), "R2", "C2");
assertEquals(2, d.getColumnCount());
assertEquals(2, d.getRowCount());
d.removeValue("R2", "C2");
assertEquals(1, d.getColumnCount());
assertEquals(1, d.getRowCount());
assertEquals(new Double(1.0), d.getValue(0, 0));
}
示例14: testCalculateColumnTotal2
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the calculateColumnTotal() method.
*/
public void testCalculateColumnTotal2() {
DefaultKeyedValues2D table = new DefaultKeyedValues2D();
table.addValue(new Double(1.0), "R0", "C0");
table.addValue(new Double(2.0), "R0", "C1");
table.addValue(new Double(3.0), "R1", "C0");
table.addValue(new Double(4.0), "R1", "C1");
assertEquals(4.0, DataUtilities.calculateColumnTotal(table, 0,
new int[] {0, 1}), EPSILON);
assertEquals(1.0, DataUtilities.calculateColumnTotal(table, 0,
new int[] {0}), EPSILON);
assertEquals(3.0, DataUtilities.calculateColumnTotal(table, 0,
new int[] {1}), EPSILON);
assertEquals(0.0, DataUtilities.calculateColumnTotal(table, 0,
new int[] {}), EPSILON);
assertEquals(6.0, DataUtilities.calculateColumnTotal(table, 1,
new int[] {0, 1}), EPSILON);
assertEquals(2.0, DataUtilities.calculateColumnTotal(table, 1,
new int[] {0}), EPSILON);
assertEquals(4.0, DataUtilities.calculateColumnTotal(table, 1,
new int[] {1}), EPSILON);
table.setValue(null, "R1", "C1");
assertEquals(2.0, DataUtilities.calculateColumnTotal(table, 1,
new int[] {0, 1}), EPSILON);
assertEquals(0.0, DataUtilities.calculateColumnTotal(table, 1,
new int[] {1}), EPSILON);
}
示例15: testCalculateRowTotal2
import org.jfree.data.DefaultKeyedValues2D; //导入方法依赖的package包/类
/**
* Some checks for the calculateRowTotal() method.
*/
public void testCalculateRowTotal2() {
DefaultKeyedValues2D table = new DefaultKeyedValues2D();
table.addValue(new Double(1.0), "R0", "C0");
table.addValue(new Double(2.0), "R0", "C1");
table.addValue(new Double(3.0), "R1", "C0");
table.addValue(new Double(4.0), "R1", "C1");
assertEquals(3.0, DataUtilities.calculateRowTotal(table, 0,
new int[] {0, 1}), EPSILON);
assertEquals(1.0, DataUtilities.calculateRowTotal(table, 0,
new int[] {0}), EPSILON);
assertEquals(2.0, DataUtilities.calculateRowTotal(table, 0,
new int[] {1}), EPSILON);
assertEquals(0.0, DataUtilities.calculateRowTotal(table, 0,
new int[] {}), EPSILON);
assertEquals(7.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {0, 1}), EPSILON);
assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {0}), EPSILON);
assertEquals(4.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {1}), EPSILON);
assertEquals(0.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {}), EPSILON);
table.setValue(null, "R1", "C1");
assertEquals(3.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {0, 1}), EPSILON);
assertEquals(0.0, DataUtilities.calculateRowTotal(table, 1,
new int[] {1}), EPSILON);
}