129-1-2

Range result = null; if (data != null) { float lowest = Float.POSITIVE_INFINITY; float highest = Float.NEGATIVE_INFINITY; for (int i = 0; i < data[0].length; i++) { float v = data[1][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } } if (lowest <= highest) { result = new Range(lowest, highest); } } return result;
Range result = null; if (data != null) { float lowest = Float.POSITIVE_INFINITY; float highest = Float.NEGATIVE_INFINITY; for (int i = 0; i < data[0].length; i++) { float v = data[0][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } } if (lowest <= highest) { result = new Range(lowest, highest); } } return result;

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 calculateYDataRange(float[][])` |  | Method name: `Range calculateXDataRange(float[][])`
Number of AST nodes: 13 |  | Number of AST nodes: 13

1

    Range result = null;↵

1

    Range result = null;↵

2

            ↵

2

            ↵

3

            if (data != null) {↵

3

            if (data != null) {↵

4

                float lowest = Float.POSITIVE_INFINITY;↵

4

                float lowest = Float.POSITIVE_INFINITY;↵

5

                float highest = Float.NEGATIVE_INFINITY;↵

5

                float highest = Float.NEGATIVE_INFINITY;↵

6

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

6

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

7

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

7

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

8

                    if (v < lowest) {↵

8

                    if (v < lowest) {↵

9

                        lowest = v;↵

9

                        lowest = v;↵

10

                    }↵

10

                    }↵

11

                    if (v > highest) {↵

11

                    if (v > highest) {↵

12

                        highest = v;↵

12

                        highest = v;↵

13

                    }↵

13

                    }↵

14

                }↵

14

                }↵

15

                if (lowest <= highest) {↵

15

                if (lowest <= highest) {↵

16

                    result = new Range(lowest, highest);↵

16

                    result = new Range(lowest, highest);↵

17

                }↵

17

                }↵

18

            }↵

18

            }↵

19

            ↵

19

            return result;

20

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
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 | 34

1. {Refactorable}

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

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

   1

       Range result = null;

   1

       Range result = null;

   2

       if (data != null)

   2

       if (data != null)

   3

       float lowest = Float.POSITIVE_INFINITY;

   3

       float lowest = Float.POSITIVE_INFINITY;

   4

       float highest = Float.NEGATIVE_INFINITY;

   4

       float highest = Float.NEGATIVE_INFINITY;

   5

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

   5

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

   6

       float v = data[1][i];

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

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

   6

       float v = data[0][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;

   11

       if (lowest <= highest)

   11

       if (lowest <= highest)

   12

       result = new Range(lowest, highest);

   12

       result = new Range(lowest, highest);

   13

       return result;

   13

       return result;

   Precondition Violations (0)
   Row | Violation
   --- | ---