if (s1 == null) { return s2 == null; } if (s2 == null) { return false; } if (s1.length != s2.length) { return false; } for (int i = 0; i < s1.length; i++) { if (!ShapeUtilities.equal(s1[i], s2[i])) { return false; } } return true;
if (array1 == null) { return (array2 == null); } if (array2 == null) { return false; } if (array1.length != array2.length) { return false; } for (int i = 0; i < array1.length; i++) { if (!Arrays.equals(array1[i], array2[i])) { return false; } } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/DefaultDrawingSupplier.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ThermometerPlot.java
Method name: boolean equalShapes(Shape[], Shape[]) Method name: boolean equal(double[][], double[][])
Number of AST nodes: 10 Number of AST nodes: 10
1
if (s1 == null) {
1
if (array1 == null) {
2
            return s2 == null;   
2
            return (array2 == null);
3
        }
3
        }
4
        if (s2 == null) {
4
        if (array2 == null) {
5
            return false;   
5
            return false;
6
        }
6
        }
7
        if (s1.length != s2.length) {
7
        if (array1.length != array2.length) {
8
            return false;   
8
            return false;
9
        }
9
        }
10
        for (int i = 0; i < s1.length; i++) {
10
        for (int i = 0; i < array1.length; i++) {
11
            if (!ShapeUtilities.equal(s1[i], s2[i])) {
11
            if (!Arrays.equals(array1[i], array2[i])) {
12
                return false;   
12
                return false;
13
            }
13
            }
14
        }
14
        }
15
        return true;
15
        return true;
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.4
Clones locationClones are in different classes
Number of node comparisons23
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (s1 == null)
    1
    if (s1 == null)
    3
    if (array2 == null)
    Differences
    Expression1Expression2Difference
    s1array2VARIABLE_NAME_MISMATCH
    java.awt.Shape[]double[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Shape[] of variable s1 does not match with type double[][] of variable array2
    • Make classes java.awt.Shape[] and double[][] extend a common superclass
    3
    if (array2 == null)
    2
    return s2 == null;
    2
    return s2 == null;
    4
    return false;
    Differences
    Expression1Expression2Difference
    s2 == nullfalseTYPE_COMPATIBLE_REPLACEMENT
    4
    return false;
    3
    if (s2 == null)
    3
    if (s2 == null)
    1
    if (array1 == null)
    Differences
    Expression1Expression2Difference
    s2array1VARIABLE_NAME_MISMATCH
    java.awt.Shape[]double[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Shape[] of variable s2 does not match with type double[][] of variable array1
    • Make classes java.awt.Shape[] and double[][] extend a common superclass
    1
    if (array1 == null)
    4
    return false;
    4
    return false;
    2
    return (array2 == null);
    Differences
    Expression1Expression2Difference
    false(array2 == null)TYPE_COMPATIBLE_REPLACEMENT
    2
    return (array2 == null);
    5
    if (s1.length != s2.length)
    5
    if (s1.length != s2.length)
    5
    if (array1.length != array2.length)
    Differences
    Expression1Expression2Difference
    s1array1VARIABLE_NAME_MISMATCH
    java.awt.Shape[]double[][]VARIABLE_TYPE_MISMATCH
    s2array2VARIABLE_NAME_MISMATCH
    java.awt.Shape[]double[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable s1.length does not match with type int of variable array1.length
    • Make classes java.awt.Shape[] and double[][] extend a common superclass
    Type int of variable s2.length does not match with type int of variable array2.length
    • Make classes java.awt.Shape[] and double[][] extend a common superclass
    5
    if (array1.length != array2.length)
    6
    return false;
    6
    return false;
                                                                                  
    7
    for (int i = 0; i < array1.length; i++)
                                                                                        
    8
    if (!Arrays.equals(array1[i], array2[i]))
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    7
    for (int i = 0; i < s1.length; i++)
                                                                          
    8
    if (!ShapeUtilities.equal(s1[i], s2[i]))
                                                                                      
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    return true;
    10
    return true;
    Precondition Violations (7)
    Row Violation
    1Type java.awt.Shape[] of variable s1 does not match with type double[][] of variable array2
    2Type java.awt.Shape[] of variable s2 does not match with type double[][] of variable array1
    3Type int of variable s1.length does not match with type int of variable array1.length
    4Type int of variable s2.length does not match with type int of variable array2.length
    5Unmatched return false;
    6Unmatched return false;
    7Not all possible execution flows end in a return statement