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 comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                    
    4
    Comparable columnKey = (Comparable)this.columnKeys.get(column);
    3
    if (rowData != null)
    3
    if (rowData != null)
    5
    if (columnKey != null)
    Differences
    Expression1Expression2Difference
    rowDatacolumnKeyVARIABLE_NAME_MISMATCH
    org.jfree.data.DefaultKeyedValuesjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression columnKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.DefaultKeyedValues of variable rowData does not match with type java.lang.Comparable of variable columnKey
    • Make classes org.jfree.data.DefaultKeyedValues and java.lang.Comparable extend a common superclass
    5
    if (columnKey != null)
    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.KeyedObjectsSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rowData cannot be unified with expression rowData , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getIndex(Comparable#RAW)
    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 or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement result=rowData.getValue(index); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                        
                                                                                  
    8
    result = rowData.getObject(columnKey);
    Preondition Violations
    Unmatched statement result=rowData.getObject(columnKey); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement result=rowData.getObject(columnKey); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    8
    result = rowData.getObject(columnKey);
    Precondition Violations (8)
    Row Violation
    1Expression columnKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Type org.jfree.data.DefaultKeyedValues of variable rowData does not match with type java.lang.Comparable of variable columnKey
    3Expression rowData cannot be unified with expression rowData , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getIndex(Comparable#RAW)
    4Unmatched statement result=rowData.getValue(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement result=rowData.getValue(index); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement result=rowData.getObject(columnKey); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement result=rowData.getObject(columnKey); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    8Clone fragment #1 returns variables index , while Clone fragment #2 returns variables