@SuppressWarnings("rawtypes") public XYEdgeSeries getSeries(Comparable key) { for(XYEdgeSeries s : seriesList) if (s.getKey().equals(key)) return s; throw new UnknownKeyException("Key not found: " + key); }
@SuppressWarnings("rawtypes") public XYEdgeSeries getSeries(Comparable key) { for(XYEdgeSeries s : seriesList) if (s.getKey().equals(key)) return s; throw new UnknownKeyException("Key not found: " + key); }
/** * Returns the start data value for one category in a series. * * @param series the required series. * @param category the required category. * * @return The start data value for one category in a series * (possibly <code>null</code>). * * @see #getStartValue(int, int) */ public Number getStartValue(Comparable series, Comparable category) { int seriesIndex = getSeriesIndex(series); if (seriesIndex < 0) { throw new UnknownKeyException("Unknown 'series' key."); } int itemIndex = getColumnIndex(category); if (itemIndex < 0) { throw new UnknownKeyException("Unknown 'category' key."); } return getStartValue(seriesIndex, itemIndex); }
/** * Removes a value from the collection. * * @param key the key (<code>null</code> not permitted). * * @see #removeValue(int) * * @throws UnknownKeyException if the key is not recognised. */ public void removeValue(Comparable key) { // defer argument checking int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key.toString() + ") is not recognised."); } removeValue(index); }
/** * Returns the number of values associated with the given <code>rowKey</code> * between the given <code>start</code> and <code>end</code> values. */ public int getCount(R rowKey, C start, C end) { // fetch the relevant pair of trees final TreePair<C> treePair = getTreePair(rowKey); // ensure we found something if (treePair == null) throw new UnknownKeyException("unrecognized rowKey: " + rowKey); // return the number of values between start and end return treePair.getCount(start, end); }
/** * Returns the number of values associated with the given <code>rowKey</code> * between the given <code>start</code> and <code>end</code> values. */ public int getCount(R rowKey, C start, C end) { // fetch the relevant pair of trees final TreePair<C> treePair = getTreePair(rowKey); // ensure we found something if (treePair == null) throw new UnknownKeyException("unrecognized rowKey: " + rowKey); // return the number of values between start and end return treePair.getCount(start, end); }
/** * Returns the number of values associated with the given <code>rowKey</code> * between the given <code>start</code> and <code>end</code> values. */ public int getCount(R rowKey, C start, C end) { // fetch the relevant pair of trees final TreePair<C> treePair = getTreePair(rowKey); // ensure we found something if (treePair == null) throw new UnknownKeyException("unrecognized rowKey: " + rowKey); // return the number of values between start and end return treePair.getCount(start, end); }
/** * Removes a value from the collection. * * @param key the key ({@code null} not permitted). * * @see #removeValue(int) * * @throws UnknownKeyException if the key is not recognised. */ public void removeValue(Comparable key) { // defer argument checking int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key.toString() + ") is not recognised."); } removeValue(index); }
/** * Removes a value from the collection. * * @param key the item key (<code>null</code> not permitted). * * @throws IllegalArgumentException if <code>key</code> is * <code>null</code>. * @throws UnknownKeyException if <code>key</code> is not recognised. */ public void removeValue(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key + ") is not recognised."); } removeValue(index); }
/** * Removes an entire row from the table. * * @param rowKey the row key (<code>null</code> not permitted). * * @throws UnknownKeyException if <code>rowKey</code> is not recognised. * * @see #removeColumn(Comparable) */ public void removeRow(Comparable rowKey) { int index = getRowIndex(rowKey); if (index < 0) { throw new UnknownKeyException("Row key (" + rowKey + ") not recognised."); } removeRow(index); }
/** * Returns the value for a given key. * * @param key the key ({@code null} not permitted). * * @return The value (possibly {@code null}). * * @throws UnknownKeyException if the key is not recognised. * * @see #getValue(int) */ @Override public Number getValue(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("Key not found: " + key); } return getValue(index); }
/** * Returns the object for a given key. If the key is not recognised, the * method should return <code>null</code>. * * @param key the key. * * @return The object (possibly <code>null</code>). * * @see #addObject(Comparable, Object) */ public Object getObject(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key + ") is not recognised."); } return getObject(index); }
/** * Returns the value for a given key. * * @param key the key (<code>null</code> not permitted). * * @return The value (possibly <code>null</code>). * * @throws UnknownKeyException if the key is not recognised. * * @see #getValue(int) */ public Number getValue(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("Key not found: " + key); } return getValue(index); }
/** * Removes a value from the collection. * * @param key the item key ({@code null} not permitted). * * @throws IllegalArgumentException if {@code key} is * {@code null}. * @throws UnknownKeyException if {@code key} is not recognised. */ public void removeValue(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key + ") is not recognised."); } removeValue(index); }
/** * Removes an entire row from the table. * * @param rowKey the row key ({@code null} not permitted). * * @throws UnknownKeyException if {@code rowKey} is not recognised. * * @see #removeColumn(Comparable) */ public void removeRow(Comparable rowKey) { int index = getRowIndex(rowKey); if (index < 0) { throw new UnknownKeyException("Row key (" + rowKey + ") not recognised."); } removeRow(index); }
/** * Returns the object for a given key. If the key is not recognised, the * method should return {@code null}. * * @param key the key. * * @return The object (possibly {@code null}). * * @see #addObject(Comparable, Object) */ public Object getObject(Comparable key) { int index = getIndex(key); if (index < 0) { throw new UnknownKeyException("The key (" + key + ") is not recognised."); } return getObject(index); }
/** * Returns the value for a pair of keys. * * @param rowKey the row key (<code>null</code> not permitted). * @param columnKey the column key (<code>null</code> not permitted). * * @return The value (possibly <code>null</code>). * * @throws UnknownKeyException if either key is not defined in the dataset. */ public Number getValue(Comparable rowKey, Comparable columnKey) { int r = getRowIndex(rowKey); int c = getColumnIndex(columnKey); if (c != -1) { return this.underlying.getValue(r, c + this.firstCategoryIndex); } else { throw new UnknownKeyException("Unknown columnKey: " + columnKey); } }
/** * Returns the end value for the interval for a given series and category. * * @param rowKey the series key. * @param columnKey the category key. * * @return The end value (possibly <code>null</code>). * * @see #getStartValue(Comparable, Comparable) */ public Number getEndValue(Comparable rowKey, Comparable columnKey) { int r = getRowIndex(rowKey); int c = getColumnIndex(columnKey); if (c != -1) { return this.underlying.getEndValue(r, c + this.firstCategoryIndex); } else { throw new UnknownKeyException("Unknown columnKey: " + columnKey); } }
/** * Removes a row from the table. * * @param rowKey the row key ({@code null} not permitted). * * @see #removeRow(int) * @see #removeColumn(Comparable) * * @throws UnknownKeyException if {@code rowKey} is not defined in the * table. */ public void removeRow(Comparable rowKey) { Args.nullNotPermitted(rowKey, "rowKey"); int index = getRowIndex(rowKey); if (index >= 0) { removeRow(index); } else { throw new UnknownKeyException("Unknown key: " + rowKey); } }
/** * Returns the percent complete for a given item. * * @param rowKey the row key. * @param columnKey the column key. * * @return The percent complete. */ public Number getPercentComplete(Comparable rowKey, Comparable columnKey) { int r = getRowIndex(rowKey); int c = getColumnIndex(columnKey); if (c != -1) { return this.underlying.getPercentComplete(r, c + this.firstCategoryIndex); } else { throw new UnknownKeyException("Unknown columnKey: " + columnKey); } }