1374-2-3

for (int item = 0; item < itemCount; item++) { double lvalue = ohlc.getLowValue(series, item); double uvalue = ohlc.getHighValue(series, item); if (!Double.isNaN(lvalue)) { minimum = Math.min(minimum, lvalue); } if (!Double.isNaN(uvalue)) { maximum = Math.max(maximum, uvalue); } }
for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { double value = dataset.getYValue(series, item); if (!Double.isNaN(value)) { minimum = Math.min(minimum, value); maximum = Math.max(maximum, value); } } }

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: `Range iterateRangeBounds(XYDataset, boolean)` |  | Method name: `Range iterateRangeBounds(XYDataset, boolean)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    for (int item = 0; item < itemCount; item++) {↵

1

    for (int series = 0; series < seriesCount; series++) {↵

2

                        double lvalue = ohlc.getLowValue(series, item);↵

2

                    int itemCount = dataset.getItemCount(series);↵

3

                    for (int item = 0; item < itemCount; item++) {↵

3

                        double uvalue = ohlc.getHighValue(series, item);↵

4

                        double value = dataset.getYValue(series, item);↵

4

                        if (!Double.isNaN(lvalue)) {↵

5

                        if (!Double.isNaN(value)) {↵

5

                            minimum = Math.min(minimum, lvalue);↵

6

                            minimum = Math.min(minimum, value);↵

6

                        }↵

7

                        if (!Double.isNaN(uvalue)) {↵

8

                            maximum = Math.max(maximum, uvalue);↵

7

                            maximum = Math.max(maximum, value);↵

9

                        }↵

8

                        }↵

10

                    }

9

                    }↵

10

                }

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 in the same method
Number of node comparisons | 16

1. {Non-refactorable}

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

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

   27 | int itemCount = dataset.getItemCount(series);

   Preondition Violations
   Unmatched statement int itemCount=dataset.getItemCount(series); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   27

       int itemCount = dataset.getItemCount(series);

   19

       for (int item = 0; item < itemCount; item++)

   28

       for (int item = 0; item < itemCount; item++)

   20

       double lvalue = ohlc.getLowValue(series, item);

   20 | double lvalue = ohlc.getLowValue(series, item);

   Preondition Violations
   Unmatched statement double lvalue=ohlc.getLowValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   21

       double uvalue = ohlc.getHighValue(series, item);

   21 | double uvalue = ohlc.getHighValue(series, item);

   Preondition Violations
   Unmatched statement double uvalue=ohlc.getHighValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   29 | double value = dataset.getYValue(series, item);

   Preondition Violations
   Unmatched statement double value=dataset.getYValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   29

       double value = dataset.getYValue(series, item);

   22

       if (!Double.isNaN(lvalue))

   22 | if (! Double.isNaN(lvalue))
   30 | if (! Double.isNaN(value))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   lvalue | value | VARIABLE_NAME_MISMATCH

   30

       if (!Double.isNaN(value))

   23

       minimum = Math.min(minimum, lvalue);

   23 | minimum = Math.min(minimum, lvalue);
   31 | minimum = Math.min(minimum, value);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   lvalue | value | VARIABLE_NAME_MISMATCH

   31

       minimum = Math.min(minimum, value);

   32 | maximum = Math.max(maximum, value);

   Preondition Violations
   Unmatched statement maximum=Math.max(maximum,value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   32

       maximum = Math.max(maximum, value);

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Unmatched statement int itemCount=dataset.getItemCount(series); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement double lvalue=ohlc.getLowValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement double uvalue=ohlc.getHighValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Unmatched statement double value=dataset.getYValue(series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   5 | Unmatched statement maximum=Math.max(maximum,value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | Clone fragment #1 returns variables item, minimum , while Clone fragment #2 returns variables item, minimum