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
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)16.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    Comparable columnKey = (Comparable)this.columnKeys.get(column);
                                                                                                                                    
    5
    int index = rowData.getIndex(columnKey);
    5
    int index = rowData.getIndex(columnKey);
    6
    int index = rowData.getIndex(columnKey);
    Differences
    Expression1Expression2Difference
    org.jfree.data.DefaultKeyedValuesorg.jfree.data.KeyedObjectsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.DefaultKeyedValues of variable rowData does not match with type org.jfree.data.KeyedObjects of variable rowData
    • Make classes org.jfree.data.DefaultKeyedValues and org.jfree.data.KeyedObjects extend a common superclass
    6
    int index = rowData.getIndex(columnKey);
    6
    if (index >= 0)
    7
    if (index >= 0)
    7
    result = rowData.getValue(index);
    7
    result = rowData.getValue(index);
    Preondition Violations
    Unmatched statement result=rowData.getValue(index); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                        
                                                                                  
    8
    result = rowData.getObject(columnKey);
    Precondition Violations (3)
    Row Violation
    1Type org.jfree.data.DefaultKeyedValues of variable rowData does not match with type org.jfree.data.KeyedObjects of variable rowData
    2Unmatched statement result=rowData.getValue(index); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Clone fragment #1 returns variables index , while Clone fragment #2 returns variables