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;
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/ThermometerPlot.java File path: /jfreechart-1.0.10/src/org/jfree/data/category/DefaultIntervalCategoryDataset.java
Method name: boolean equal(double[][], double[][]) Method name: boolean equal(Number[][], Number[][])
Number of AST nodes: 10 Number of AST nodes: 10
1
if (array1 == null) {
1
if (array1 == null) {
2
            return (array2 == null);
2
            return (array2 == null);
3
        }
3
        }
4
        if (array2 == null) {
4
        if (array2 == null) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        if (array1.length != array2.length) {
7
        if (array1.length != array2.length) {
8
            return false;
8
            return false;
9
        }
9
        }
10
        for (int i = 0; i < array1.length; i++) {
10
        for (int i = 0; i < array1.length; i++) {
11
            if (!Arrays.equals(array1[i], array2[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.9
Clones locationClones are in different classes
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (array1 == null)
    1
    if (array1 == null)
    1
    if (array1 == null)
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double[][] of variable array1 does not match with type java.lang.Number[][] of variable array1
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    1
    if (array1 == null)
    2
    return (array2 == null);
    2
    return (array2 == null);
    2
    return (array2 == null);
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    2
    return (array2 == null);
    3
    if (array2 == null)
    3
    if (array2 == null)
    3
    if (array2 == null)
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    3
    if (array2 == null)
    4
    return false;
    4
    return false;
    5
    if (array1.length != array2.length)
    5
    if (array1.length != array2.length)
    5
    if (array1.length != array2.length)
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable array1.length does not match with type int of variable array1.length
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    Type int of variable array2.length does not match with type int of variable array2.length
    • Make classes double[][] and java.lang.Number[][] 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++)
    7
    for (int i = 0; i < array1.length; i++)
    7
    for (int i = 0; i < array1.length; i++)
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable array1.length does not match with type int of variable array1.length
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    7
    for (int i = 0; i < array1.length; i++)
    8
    if (!Arrays.equals(array1[i], array2[i]))
    8
    if (!Arrays.equals(array1[i], array2[i]))
    8
    if (!Arrays.equals(array1[i], array2[i]))
    Differences
    Expression1Expression2Difference
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    double[][]java.lang.Number[][]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double[][] of variable array1 does not match with type java.lang.Number[][] of variable array1
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2
    • Make classes double[][] and java.lang.Number[][] extend a common superclass
    8
    if (!Arrays.equals(array1[i], array2[i]))
    9
    return false;
    9
    return false;
    10
    return true;
    10
    return true;
    Precondition Violations (8)
    Row Violation
    1Type double[][] of variable array1 does not match with type java.lang.Number[][] of variable array1
    2Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2
    3Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2
    4Type int of variable array1.length does not match with type int of variable array1.length
    5Type int of variable array2.length does not match with type int of variable array2.length
    6Type int of variable array1.length does not match with type int of variable array1.length
    7Type double[][] of variable array1 does not match with type java.lang.Number[][] of variable array1
    8Type double[][] of variable array2 does not match with type java.lang.Number[][] of variable array2