RankProbabilityDataset extends DefaultCategoryDataset { @SuppressWarnings("rawtypes") @Override public int getColumnIndex(Comparable key) { if (!(key instanceof String) && !(key instanceof Treatment)) { return -1; } String treatment = key instanceof String ? (String) key : ((Treatment)key).getId(); int idx = 0; for (Treatment t : d_summary.getTreatments()) { if (t.getId().equals(treatment)) { return idx; } ++idx; } return -1; } 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 testGetColumnIndex() { assertEquals(0, d_dataSet.getColumnIndex(d_ta.getId())); assertEquals(1, d_dataSet.getColumnIndex(d_tb.getId())); assertEquals(2, d_dataSet.getColumnIndex(d_tc.getId())); }
@Test public void testGetColumnIndexThrows() { assertEquals(-1, d_dataSet.getColumnIndex(10000)); }