Skip to content

Commit

Permalink
fixed files form Chart #18
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 56ce346 commit 4d41631
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions projects/Chart/18/org/jfree/data/DefaultKeyedValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,7 @@ private void rebuildIndex () {
public void removeValue(int index) {
this.keys.remove(index);
this.values.remove(index);
if (index < this.keys.size()) {
rebuildIndex();
}
}

/**
Expand All @@ -332,7 +330,8 @@ public void removeValue(int index) {
public void removeValue(Comparable key) {
int index = getIndex(key);
if (index < 0) {
return;
throw new UnknownKeyException("The key (" + key
+ ") is not recognised.");
}
removeValue(index);
}
Expand Down
9 changes: 9 additions & 0 deletions projects/Chart/18/org/jfree/data/DefaultKeyedValues2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,19 @@ public void removeColumn(int columnIndex) {
* @see #removeRow(Comparable)
*/
public void removeColumn(Comparable columnKey) {
if (columnKey == null) {
throw new IllegalArgumentException("Null 'columnKey' argument.");
}
if (!this.columnKeys.contains(columnKey)) {
throw new UnknownKeyException("Unknown key: " + columnKey);
}
Iterator iterator = this.rows.iterator();
while (iterator.hasNext()) {
DefaultKeyedValues rowData = (DefaultKeyedValues) iterator.next();
int index = rowData.getIndex(columnKey);
if (index >= 0) {
rowData.removeValue(columnKey);
}
}
this.columnKeys.remove(columnKey);
}
Expand Down

0 comments on commit 4d41631

Please sign in to comment.