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;
double total = 0.0; int seriesCount = dataset.getSeriesCount(); for (int s = 0; s < seriesCount; s++) { double value = dataset.getYValue(s, item); if (!Double.isNaN(value)) { total = total + value; } } 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/general/DatasetUtilities.java
Method name: double calculateRowTotal(Values2D, int) Method name: double calculateStackTotal(TableXYDataset, int)
Number of AST nodes: 7 Number of AST nodes: 7
1
double total = 0.0;
1
double total = 0.0;
2
        int columnCount = data.getColumnCount();
2
        int seriesCount = dataset.getSeriesCount();
3
        for (int c = 0; c < columnCount; c++) {
3
        for (int s = 0; s < seriesCount; s++) {
4
            Number n = data.getValue(row, c);
4
            double value = dataset.getYValue(s, item);
5
            if (n != null) {
5
            if (!Double.isNaN(value)) {
6
                total += n.doubleValue();   
6
                total = total + value;
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.1
Clones locationClones are in different classes
Number of node comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    double total = 0.0;
    1
    double total = 0.0;
                                                                                            
    2
    int seriesCount = dataset.getSeriesCount();
    2
    int columnCount = data.getColumnCount();
                                                                                      
    3
    for (int c = 0; c < columnCount; c++)
    3
    for (int c = 0; c < columnCount; c++)
    3
    for (int s = 0; s < seriesCount; s++)
    Differences
    Expression1Expression2Difference
    csVARIABLE_NAME_MISMATCH
    csVARIABLE_NAME_MISMATCH
    columnCountseriesCountVARIABLE_NAME_MISMATCH
    csVARIABLE_NAME_MISMATCH
    3
    for (int s = 0; s < seriesCount; s++)
                                                                                        
    4
    double value = dataset.getYValue(s, item);
    Preondition Violations
    Unmatched statement double value=dataset.getYValue(s,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    double value = dataset.getYValue(s, item);
    4
    Number n = data.getValue(row, c);
    4
    Number n = data.getValue(row, c);
    Preondition Violations
    Unmatched statement Number n=data.getValue(row,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
                                                          
    5
    if (!Double.isNaN(value))
                                                  
    6
    total = total + value;
    Preondition Violations
    Unmatched statement total=total + value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    total = total + value;
    5
    if (n != null)
                                    
    6
    total += n.doubleValue();
    6
    total += n.doubleValue();
    Preondition Violations
    Unmatched statement total+=n.doubleValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
    7
    return total;
    7
    return total;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement double value=dataset.getYValue(s,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Number n=data.getValue(row,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement total=total + value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement total+=n.doubleValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted