if (rowData != null) {
Comparable columnKey = (Comparable) this.columnKeys.get(column);
// the row may not have an entry for this key, in which case the
// return value is null
int index = rowData.getIndex(columnKey);
if (index >= 0) {
result = rowData.getValue(index);
}
}
Comparable columnKey = (Comparable) this.columnKeys.get(column);
if (columnKey != null) {
int index = rowData.getIndex(columnKey);
if (index >= 0) {
result = rowData.getObject(columnKey);
}
}
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/DefaultKeyedValues2D.java
|
|
File path: /jfreechart-1.0.10/src/org/jfree/data/KeyedObjects2D.java
|
Method name: Number getValue(int, int)
|
|
Method name: Object getObject(int, int)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if (rowData != null) {↵ | | |
|
2 | Comparable columnKey = (Comparable) this.columnKeys.get(column);↵ | | 1 | Comparable columnKey = (Comparable) this.columnKeys.get(column);↵
|
3 | // the row may not have an entry for this key, in which case the ↵ | | 2 | ↵
|
4 | // return value is null↵ | | |
|
| | | 3 | if (columnKey != null) {↵
|
5 | int index = rowData.getIndex(columnKey);↵ | | 4 | int index = rowData.getIndex(columnKey);↵
|
6 | if (index >= 0) {↵ | | 5 | if (index >= 0) {↵
|
7 | result = rowData.getValue(index);↵ | | 6 | result = rowData.getObject(columnKey);↵
|
8 | }↵ | | 7 | ↵
|
| | | 8 | }↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 7 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 16.9 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | Comparable columnKey = (Comparable)this.columnKeys.get(column); | | | |
5 | int index = rowData.getIndex(columnKey); | | 6 | int index = rowData.getIndex(columnKey); |
6 | if (index >= 0) | | 7 | if (index >= 0) |
7 | result = rowData.getValue(index); | | | |
| | | 8 | result = rowData.getObject(columnKey); |
Precondition Violations (3)
Row |
Violation |
1 | Type org.jfree.data.DefaultKeyedValues of variable rowData does not match with type org.jfree.data.KeyedObjects of variable rowData |
2 | Unmatched statement result=rowData.getValue(index); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Clone fragment #1 returns variables index , while Clone fragment #2 returns variables |