Java Code Examples for org.jfree.data.DefaultKeyedValues#removeValue()

The following examples show how to use org.jfree.data.DefaultKeyedValues#removeValue() . 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: DefaultKeyedValuesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: DefaultKeyedValuesTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: DefaultKeyedValuesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Another check for the getIndex(Comparable) method.
 */
public void testGetIndex2() {
    DefaultKeyedValues v = new DefaultKeyedValues();
    assertEquals(-1, v.getIndex("K1"));
    v.addValue("K1", 1.0);
    assertEquals(0, v.getIndex("K1"));
    v.removeValue("K1");
    assertEquals(-1, v.getIndex("K1"));
}
 
Example 4
Source File: DefaultKeyedValuesTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Another check for the getIndex(Comparable) method.
 */
public void testGetIndex2() {
	DefaultKeyedValues v = new DefaultKeyedValues();
	assertEquals(-1, v.getIndex("K1"));
	v.addValue("K1", 1.0);
	assertEquals(0, v.getIndex("K1"));
	v.removeValue("K1");
	assertEquals(-1, v.getIndex("K1"));
}