Example usage for org.jfree.data DefaultKeyedValues2D getRowKey

List of usage examples for org.jfree.data DefaultKeyedValues2D getRowKey

Introduction

In this page you can find the example usage for org.jfree.data DefaultKeyedValues2D getRowKey.

Prototype

@Override
public Comparable getRowKey(int row) 

Source Link

Document

Returns the key for a given row.

Usage

From source file:org.jfree.data.DefaultKeyedValues2DTest.java

/**
 * Some basic checks for the getRowKey() method.
 *//*from  w  w w.ja  va2s  .c  o  m*/
@Test
public void testGetRowKey() {
    DefaultKeyedValues2D d = new DefaultKeyedValues2D();
    boolean pass = false;
    try {
        d.getRowKey(0);
    } catch (IndexOutOfBoundsException e) {
        pass = true;
    }
    assertTrue(pass);
    d.addValue(new Double(1.0), "R1", "C1");
    d.addValue(new Double(1.0), "R2", "C1");
    assertEquals("R1", d.getRowKey(0));
    assertEquals("R2", d.getRowKey(1));

    // check sorted rows
    d = new DefaultKeyedValues2D(true);
    d.addValue(new Double(1.0), "R1", "C1");
    assertEquals("R1", d.getRowKey(0));
    d.addValue(new Double(0.0), "R0", "C1");
    assertEquals("R0", d.getRowKey(0));
    assertEquals("R1", d.getRowKey(1));
}