RankProbabilityDataset extends DefaultCategoryDataset { @SuppressWarnings("rawtypes") @Override public int getRowIndex(Comparable key) { if (!(key instanceof String)) { return -1; } String str = (String) key; int idx = Integer.parseInt(str.substring(5)) - 1; if (idx < 0 || idx >= d_summary.getTreatments().size()) { return -1; } return idx; } RankProbabilityDataset(RankProbabilitySummary rankProbabilitySummary, boolean preferDescription);  RankProbabilityDataset(RankProbabilitySummary rankProbabilitySummary); @SuppressWarnings("rawtypes") @Override int getRowIndex(Comparable key); @SuppressWarnings("rawtypes") @Override int getColumnIndex(Comparable key); @Override String getRowKey(int row); @Override String getColumnKey(int column); @Override List<String> getRowKeys(); @Override List<String> getColumnKeys(); @Override int getRowCount(); @Override int getColumnCount(); @Override Number getValue(int row, int column); @SuppressWarnings("rawtypes") @Override Number getValue(Comparable rowKey, Comparable columnKey);  }
@Test public void testGetRowIndex() { Integer key = 3; assertEquals(key - 1, d_dataSet.getRowIndex("Rank " + key) ); }
@Test public void testGetRowIndexThrows() { assertEquals(-1, d_dataSet.getRowIndex(10000)); }