List of usage examples for org.jfree.data DefaultKeyedValues2D DefaultKeyedValues2D
public DefaultKeyedValues2D()
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Some checks for the getValue() method. *///from w ww . jav a 2s . c om @Test public void testGetValue() { DefaultKeyedValues2D d = new DefaultKeyedValues2D(); d.addValue(new Double(1.0), "R1", "C1"); assertEquals(new Double(1.0), d.getValue("R1", "C1")); boolean pass = false; try { d.getValue("XX", "C1"); } catch (UnknownKeyException e) { pass = true; } assertTrue(pass); pass = false; try { d.getValue("R1", "XX"); } catch (UnknownKeyException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.category.DefaultCategoryDataset.java
/** * Creates a new (empty) dataset. */ public DefaultCategoryDataset() { this.data = new DefaultKeyedValues2D(); }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Some checks for the clone() method.//from w w w .jav a2 s .c o m */ @Test public void testCloning() throws CloneNotSupportedException { DefaultKeyedValues2D v1 = new DefaultKeyedValues2D(); v1.setValue(new Integer(1), "V1", "C1"); v1.setValue(null, "V2", "C1"); v1.setValue(new Integer(3), "V3", "C2"); DefaultKeyedValues2D v2 = (DefaultKeyedValues2D) v1.clone(); assertTrue(v1 != v2); assertTrue(v1.getClass() == v2.getClass()); assertTrue(v1.equals(v2)); // check that clone is independent of the original v2.setValue(new Integer(2), "V2", "C1"); assertFalse(v1.equals(v2)); }
From source file:org.jfree.data.WaferMapDataset.java
/** * Creates a new dataset.//from w w w. j a va2 s .c om * * @param maxChipX * the wafer x-dimension. * @param maxChipY * the wafer y-dimension. * @param chipSpace * the space between chips. */ public WaferMapDataset(final int maxChipX, final int maxChipY, final Number chipSpace) { this.maxValue = new Double(Double.NEGATIVE_INFINITY); this.minValue = new Double(Double.POSITIVE_INFINITY); this.data = new DefaultKeyedValues2D(); this.maxChipX = maxChipX; this.maxChipY = maxChipY; if (chipSpace == null) { this.chipSpace = DEFAULT_CHIP_SPACE; } else { this.chipSpace = chipSpace.doubleValue(); } }
From source file:org.jfree.data.general.WaferMapDataset.java
/** * Creates a new dataset./*w w w . j a v a 2 s .c o m*/ * * @param maxChipX the wafer x-dimension. * @param maxChipY the wafer y-dimension. * @param chipSpace the space between chips. */ public WaferMapDataset(int maxChipX, int maxChipY, Number chipSpace) { this.maxValue = new Double(Double.NEGATIVE_INFINITY); this.minValue = new Double(Double.POSITIVE_INFINITY); this.data = new DefaultKeyedValues2D(); this.maxChipX = maxChipX; this.maxChipY = maxChipY; if (chipSpace == null) { this.chipSpace = DEFAULT_CHIP_SPACE; } else { this.chipSpace = chipSpace.doubleValue(); } }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Serialize an instance, restore it, and check for equality. */// www .j a v a2 s . com @Test public void testSerialization() { DefaultKeyedValues2D kv2D1 = new DefaultKeyedValues2D(); kv2D1.addValue(new Double(234.2), "Row1", "Col1"); kv2D1.addValue(null, "Row1", "Col2"); kv2D1.addValue(new Double(345.9), "Row2", "Col1"); kv2D1.addValue(new Double(452.7), "Row2", "Col2"); DefaultKeyedValues2D kv2D2 = (DefaultKeyedValues2D) TestUtilities.serialised(kv2D1); assertEquals(kv2D1, kv2D2); }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Some checks for the equals() method./*from w w w . ja v a 2 s . c o m*/ */ @Test 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)); }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Populates a data structure with sparse entries, then checks that * the unspecified entries return null.//w w w. ja va 2s . c o m */ @Test 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")); }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Some basic checks for the getRowCount() method. *//*from w w w . ja v a2 s .com*/ @Test 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()); }
From source file:org.jfree.data.DefaultKeyedValues2DTest.java
/** * Some basic checks for the getColumnCount() method. *//*from w w w .j a v a2 s. com*/ @Test 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()); }