1503-1-2

for (int i = 0; i < data[0].length; i++) { float v = data[0][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } }
for (int i = 0; i < data[0].length; i++) { float v = data[1][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/FastScatterPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/FastScatterPlot.java
Method name: `Range calculateXDataRange(float[][])` |  | Method name: `Range calculateYDataRange(float[][])`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

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

1

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

2

                    float v = data[0][i];↵

2

                    float v = data[1][i];↵

3

                    if (v < lowest) {↵

3

                    if (v < lowest) {↵

4

                        lowest = v;↵

4

                        lowest = v;↵

5

                    }↵

5

                    }↵

6

                    if (v > highest) {↵

6

                    if (v > highest) {↵

7

                        highest = v;↵

7

                        highest = v;↵

8

                    }↵

8

                    }↵

9

                }

9

                }

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.3
Clones location | Clones are declared in the same class
Number of node comparisons | 18

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   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) | 0.7
   Clone type | Type 2

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

   5

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

   5

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

   6

       float v = data[0][i];

   6 | float v = data[0][i];
   6 | float v = data[1][i];

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0 | 1 | LITERAL_VALUE_MISMATCH

   6

       float v = data[1][i];

   7

       if (v < lowest)

   7

       if (v < lowest)

   8

       lowest = v;

   8

       lowest = v;

   9

       if (v > highest)

   9

       if (v > highest)

   10

       highest = v;

   10

       highest = v;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Clone fragment #1 returns variables lowest, highest , while Clone fragment #2 returns variables lowest, highest