double total = 0.0; int rowCount = data.getRowCount(); for (int r = 0; r < rowCount; r++) { Number n = data.getValue(r, column); if (n != null) { total += n.doubleValue(); } } return total;
double total = 0.0; int columnCount = data.getColumnCount(); for (int c = 0; c < columnCount; c++) { Number n = data.getValue(row, c); if (n != null) { total += n.doubleValue(); } } return total;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/DataUtilities.java File path: /jfreechart-1.0.10/src/org/jfree/data/DataUtilities.java
Method name: double calculateColumnTotal(Values2D, int) Method name: double calculateRowTotal(Values2D, int)
Number of AST nodes: 7 Number of AST nodes: 7
1
double total = 0.0;
1
double total = 0.0;
2
        int rowCount = data.getRowCount();
2
        int columnCount = data.getColumnCount();
3
        for (int r = 0; r < rowCount; r++) {
3
        for (int c = 0; c < columnCount; c++) {
4
            Number n = data.getValue(r, column);
4
            Number n = data.getValue(row, c);
5
            if (n != null) {
5
            if (n != null) {
6
                total += n.doubleValue();   
6
                total += n.doubleValue();   
7
            }
7
            }
8
        }
8
        }
9
        return total;
9
        return total;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    double total = 0.0;
    1
    double total = 0.0;
    2
    int rowCount = data.getRowCount();
    2
    int rowCount = data.getRowCount();
    2
    int columnCount = data.getColumnCount();
    Differences
    Expression1Expression2Difference
    rowCountcolumnCountVARIABLE_NAME_MISMATCH
    getRowCountgetColumnCountMETHOD_INVOCATION_NAME_MISMATCH
    2
    int columnCount = data.getColumnCount();
    3
    for (int r = 0; r < rowCount; r++)
    3
    for (int r = 0; r < rowCount; r++)
    3
    for (int c = 0; c < columnCount; c++)
    Differences
    Expression1Expression2Difference
    rcVARIABLE_NAME_MISMATCH
    rcVARIABLE_NAME_MISMATCH
    rowCountcolumnCountVARIABLE_NAME_MISMATCH
    rcVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression r cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    for (int c = 0; c < columnCount; c++)
    4
    Number n = data.getValue(r, column);
    4
    Number n = data.getValue(r, column);
    4
    Number n = data.getValue(row, c);
    Differences
    Expression1Expression2Difference
    rrowVARIABLE_NAME_MISMATCH
    columncVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression r cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    Number n = data.getValue(row, c);
    5
    if (n != null)
    5
    if (n != null)
    6
    total += n.doubleValue();
    6
    total += n.doubleValue();
    7
    return total;
    7
    return total;
    Precondition Violations (4)
    Row Violation
    1Expression r cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression r cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted