1780-1-2

for (int r = 0; r < data.length; r++) { String rowKey = rowKeyPrefix + (r + 1); for (int c = 0; c < data[r].length; c++) { String columnKey = columnKeyPrefix + (c + 1); result.addValue(new Double(data[r][c]), rowKey, columnKey); } }
for (int r = 0; r < data.length; r++) { String rowKey = rowKeyPrefix + (r + 1); for (int c = 0; c < data[r].length; c++) { String columnKey = columnKeyPrefix + (c + 1); result.addValue(data[r][c], rowKey, columnKey); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetUtilities.java
Method name: `CategoryDataset createCategoryDataset(String, String, double[][])` |  | Method name: `CategoryDataset createCategoryDataset(String, String, Number[][])`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    for (int r = 0; r < data.length; r++) {↵

1

    for (int r = 0; r < data.length; r++) {↵

2

                String rowKey = rowKeyPrefix + (r + 1);↵

2

                String rowKey = rowKeyPrefix + (r + 1);↵

3

                for (int c = 0; c < data[r].length; c++) {↵

3

                for (int c = 0; c < data[r].length; c++) {↵

4

                    String columnKey = columnKeyPrefix + (c + 1);↵

4

                    String columnKey = columnKeyPrefix + (c + 1);↵

5

                    result.addValue(new Double(data[r][c]), rowKey, columnKey);↵

5

                    result.addValue(data[r][c], rowKey, columnKey);↵

6

                }↵

6

                }↵

7

            }

7

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4
Clones location | Clones are declared in the same class
Number of node comparisons | 14

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 5
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 7.6
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   2

       for (int r = 0; r < data.length; r++)

   2 | for (int r = 0; r < data.length; r++)
   2 | for (int r = 0; r < data.length; r++)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   double[][] | java.lang.Number[][] | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type double[][] of variable data does not match with type java.lang.Number[][] of variable data
   - Make classes double[][] and java.lang.Number[][] extend a common superclass

   2

       for (int r = 0; r < data.length; r++)

   3

       String rowKey = rowKeyPrefix + (r + 1);

   3

       String rowKey = rowKeyPrefix + (r + 1);

   4

       for (int c = 0; c < data[r].length; c++)

   4 | for (int c = 0; c < data[r].length; c++)
   4 | for (int c = 0; c < data[r].length; c++)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   double[][] | java.lang.Number[][] | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type double[][] of variable data does not match with type java.lang.Number[][] of variable data
   - Make classes double[][] and java.lang.Number[][] extend a common superclass

   4

       for (int c = 0; c < data[r].length; c++)

   5

       String columnKey = columnKeyPrefix + (c + 1);

   5

       String columnKey = columnKeyPrefix + (c + 1);

   6

       result.addValue(new Double(data[r][c]), rowKey, columnKey);

   6 | result.addValue(new Double(data[r][c]), rowKey, columnKey);
   6 | result.addValue(data[r][c], rowKey, columnKey);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   new Double(data[r][c]) | data[r][c] | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression new Double(data[r][c]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression data[r][c] cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       result.addValue(data[r][c], rowKey, columnKey);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Type double[][] of variable data does not match with type java.lang.Number[][] of variable data
   2 | Type double[][] of variable data does not match with type java.lang.Number[][] of variable data
   3 | Expression new Double(data[r][c]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression data[r][c] cannot be parameterized, because it has dependencies to/from statements that will be extracted