org.jfree.data.DefaultKeyedValues2D Java Examples

The following examples show how to use org.jfree.data.DefaultKeyedValues2D. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WaferMapDataset.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #2
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #4
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #5
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: WaferMapDataset.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #7
Source File: WaferMapDataset.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 * 
 * @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();
    }

}
 
Example #8
Source File: WaferMapDataset.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #9
Source File: WaferMapDataset.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #10
Source File: WaferMapDataset.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 * 
 * @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();
    }

}
 
Example #11
Source File: WaferMapDataset.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #12
Source File: WaferMapDataset.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #13
Source File: WaferMapDataset.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new dataset.
 *
 * @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();
    }

}
 
Example #14
Source File: TimeTableXYDataset.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 * 
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    if (zone == null) {
        throw new IllegalArgumentException("Null 'zone' argument.");
    }
    if (locale == null) {
        throw new IllegalArgumentException("Null 'locale' argument.");
    }
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #15
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some basic checks for the removeRow() method.
 */
public void testRemoveRow() {
    DefaultKeyedValues2D d = new DefaultKeyedValues2D();
    boolean pass = false;
    try {
        d.removeRow(0);
    }
    catch (IndexOutOfBoundsException e) {
        pass = true;
    }
    assertTrue(pass);        
}
 
Example #16
Source File: TimeTableXYDataset.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 * 
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    if (zone == null) {
        throw new IllegalArgumentException("Null 'zone' argument.");
    }
    if (locale == null) {
        throw new IllegalArgumentException("Null 'locale' argument.");
    }
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #17
Source File: DataUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: DataUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #20
Source File: TimeTableXYDataset.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    ParamChecks.nullNotPermitted(zone, "zone");
    ParamChecks.nullNotPermitted(locale, "locale");
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #21
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #22
Source File: ExtTimeTableXYDataset.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone   the time zone to use (<code>null</code> not permitted).
 * @param locale the locale to use (<code>null</code> not permitted).
 */
public ExtTimeTableXYDataset( final TimeZone zone, final Locale locale ) {
  if ( zone == null ) {
    throw new IllegalArgumentException( "Null 'zone' argument." );
  }
  if ( locale == null ) {
    throw new IllegalArgumentException( "Null 'locale' argument." );
  }
  this.values = new DefaultKeyedValues2D( true );
  this.workingCalendar = Calendar.getInstance( zone, locale );
  this.xPosition = TimePeriodAnchor.START;
}
 
Example #23
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
}
 
Example #24
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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"));
}
 
Example #25
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example #26
Source File: TimeTableXYDataset.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    if (zone == null) {
        throw new IllegalArgumentException("Null 'zone' argument.");
    }
    if (locale == null) {
        throw new IllegalArgumentException("Null 'locale' argument.");
    }
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #27
Source File: TimeTableXYDataset.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    ParamChecks.nullNotPermitted(zone, "zone");
    ParamChecks.nullNotPermitted(locale, "locale");
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #28
Source File: TimeTableXYDataset.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new dataset with the given time zone and locale.
 *
 * @param zone  the time zone to use (<code>null</code> not permitted).
 * @param locale  the locale to use (<code>null</code> not permitted).
 */
public TimeTableXYDataset(TimeZone zone, Locale locale) {
    ParamChecks.nullNotPermitted(zone, "zone");
    ParamChecks.nullNotPermitted(locale, "locale");
    this.values = new DefaultKeyedValues2D(true);
    this.workingCalendar = Calendar.getInstance(zone, locale);
    this.xPosition = TimePeriodAnchor.START;
}
 
Example #29
Source File: DataUtilitiesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #30
Source File: DefaultKeyedValues2DTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}