Comparable k1 = getKey(i); Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false; } Number v1 = getValue(i); Number v2 = that.getValue(i); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } }
Comparable k1 = getKey(i); Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false; } Object o1 = getObject(i); Object o2 = that.getObject(i); if (o1 == null) { if (o2 != null) { return false; } } else { if (!o1.equals(o2)) { return false; } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/DefaultKeyedValues.java File path: /jfreechart-1.0.10/src/org/jfree/data/KeyedObjects.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 11 Number of AST nodes: 11
1
Comparable k1 = getKey(i);
1
Comparable k1 = getKey(i);
2
            Comparable k2 = that.getKey(i);
2
            Comparable k2 = that.getKey(i);
3
            if (!k1.equals(k2)) {
3
            if (!k1.equals(k2)) {
4
                return false;
4
                return false;
5
            }
5
            }
6
            Number v1 = getValue(i);
6
            Object o1 = getObject(i);
7
            Number v2 = that.getValue(i);
7
            Object o2 = that.getObject(i);
8
            if (v1 == null) {
8
            if (o1 == null) {
9
                if (v2 != null) {
9
                if (o2 != null) {
10
                    return false;
10
                    return false;
11
                }
11
                }
12
            }
12
            }
13
            else {
13
            else {
14
                if (!v1.equals(v2)) {
14
                if (!o1.equals(o2)) {
15
                    return false;
15
                    return false;
16
                }
16
                }
17
            }
17
            }
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.6
Clones locationClones are in different classes
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    Comparable k1 = getKey(i);
    10
    Comparable k1 = getKey(i);
    11
    Comparable k2 = that.getKey(i);
    11
    Comparable k2 = that.getKey(i);
    11
    Comparable k2 = that.getKey(i);
    Differences
    Expression1Expression2Difference
    org.jfree.data.KeyedValuesorg.jfree.data.KeyedObjectsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.KeyedValues of variable that does not match with type org.jfree.data.KeyedObjects of variable that
    • Make classes org.jfree.data.KeyedValues and org.jfree.data.KeyedObjects extend a common superclass
    11
    Comparable k2 = that.getKey(i);
    12
    if (!k1.equals(k2))
    12
    if (!k1.equals(k2))
    13
    return false;
    13
    return false;
                                                          
    14
    Object o1 = getObject(i);
    Preondition Violations
    Unmatched statement Object o1=getObject(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    Object o1 = getObject(i);
    14
    Number v1 = getValue(i);
    14
    Number v1 = getValue(i);
    Preondition Violations
    Unmatched statement Number v1=getValue(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
                                                                    
    15
    Object o2 = that.getObject(i);
    Preondition Violations
    Unmatched statement Object o2=that.getObject(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    Object o2 = that.getObject(i);
    15
    Number v2 = that.getValue(i);
    15
    Number v2 = that.getValue(i);
    Preondition Violations
    Unmatched statement Number v2=that.getValue(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    16
    if (v1 == null)
    16
    if (v1 == null)
    16
    if (o1 == null)
    Differences
    Expression1Expression2Difference
    v1o1VARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable o1
    • Make classes java.lang.Number and java.lang.Object extend a common superclass
    16
    if (o1 == null)
    17
    if (v2 != null)
    17
    if (v2 != null)
    17
    if (o2 != null)
    Differences
    Expression1Expression2Difference
    v2o2VARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable o2
    • Make classes java.lang.Number and java.lang.Object extend a common superclass
    17
    if (o2 != null)
    18
    return false;
    18
    return false;
    else
    else
    19
    if (!v1.equals(v2))
    19
    if (!v1.equals(v2))
    19
    if (!o1.equals(o2))
    Differences
    Expression1Expression2Difference
    v2o2VARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    v1o1VARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable o2
    • Make classes java.lang.Number and java.lang.Object extend a common superclass
    Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable o1
    • Make classes java.lang.Number and java.lang.Object extend a common superclass
    19
    if (!o1.equals(o2))
    20
    return false;
    20
    return false;
    Precondition Violations (10)
    Row Violation
    1Type org.jfree.data.KeyedValues of variable that does not match with type org.jfree.data.KeyedObjects of variable that
    2Unmatched statement Object o1=getObject(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Number v1=getValue(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Object o2=that.getObject(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement Number v2=that.getValue(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable o1
    7Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable o2
    8Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable o2
    9Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable o1
    10Not all possible execution flows end in a return statement