318-1-2

if (dataset instanceof VectorXYDataset) { VectorXYDataset vdataset = (VectorXYDataset) dataset; for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { double delta = vdataset.getVectorXValue(series, item); if (delta < 0.0) { uvalue = vdataset.getXValue(series, item); lvalue = uvalue + delta; } else { lvalue = vdataset.getXValue(series, item); uvalue = lvalue + delta; } minimum = Math.min(minimum, lvalue); maximum = Math.max(maximum, uvalue); } } } else { for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { lvalue = dataset.getXValue(series, item); uvalue = lvalue; minimum = Math.min(minimum, lvalue); maximum = Math.max(maximum, uvalue); } } }
if (dataset instanceof VectorXYDataset) { VectorXYDataset vdataset = (VectorXYDataset) dataset; for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { double delta = vdataset.getVectorYValue(series, item); if (delta < 0.0) { uvalue = vdataset.getYValue(series, item); lvalue = uvalue + delta; } else { lvalue = vdataset.getYValue(series, item); uvalue = lvalue + delta; } minimum = Math.min(minimum, lvalue); maximum = Math.max(maximum, uvalue); } } } else { for (int series = 0; series < seriesCount; series++) { int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { lvalue = dataset.getYValue(series, item); uvalue = lvalue; minimum = Math.min(minimum, lvalue); maximum = Math.max(maximum, uvalue); } } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/VectorRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/VectorRenderer.java
Method name: `Range findDomainBounds(XYDataset)` |  | Method name: `Range findRangeBounds(XYDataset)`
Number of AST nodes: 20 |  | Number of AST nodes: 20

1

    if (dataset instanceof VectorXYDataset) {↵

1

    if (dataset instanceof VectorXYDataset) {↵

2

                VectorXYDataset vdataset = (VectorXYDataset) dataset;↵

2

                VectorXYDataset vdataset = (VectorXYDataset) dataset;↵

3

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

3

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

4

                    int itemCount = dataset.getItemCount(series);↵

4

                    int itemCount = dataset.getItemCount(series);↵

5

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

5

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

6

                        double delta = vdataset.getVectorXValue(series, item);↵

6

                        double delta = vdataset.getVectorYValue(series, item);↵

7

                        if (delta < 0.0) {↵

7

                        if (delta < 0.0) {↵

8

                            uvalue = vdataset.getXValue(series, item);↵

8

                            uvalue = vdataset.getYValue(series, item);↵

9

                            lvalue = uvalue + delta;↵

9

                            lvalue = uvalue + delta;↵

10

                        }↵

10

                        }↵

11

                        else {↵

11

                        else {↵

12

                            lvalue = vdataset.getXValue(series, item);↵

12

                            lvalue = vdataset.getYValue(series, item);↵

13

                            uvalue = lvalue + delta;↵

13

                            uvalue = lvalue + delta;↵

14

                        }↵

14

                        }↵

15

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

15

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

16

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

16

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

17

                    }↵

17

                    }↵

18

                }↵

18

                }↵

19

            }↵

19

            }↵

20

            else {↵

20

            else {↵

21

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

21

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

22

                    int itemCount = dataset.getItemCount(series);↵

22

                    int itemCount = dataset.getItemCount(series);↵

23

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

23

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

24

                        lvalue = dataset.getXValue(series, item);↵

24

                        lvalue = dataset.getYValue(series, item);↵

25

                        uvalue = lvalue;↵

25

                        uvalue = lvalue;↵

26

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

26

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

27

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

27

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

28

                    }↵

28

                    }↵

29

                }↵

29

                }↵

30

            }

30

            }

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 20
   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.1
   Clone type | Type 2

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

   8

       if (dataset instanceof VectorXYDataset)

   8

       if (dataset instanceof VectorXYDataset)

   9

       VectorXYDataset vdataset = (VectorXYDataset)dataset;

   9

       VectorXYDataset vdataset = (VectorXYDataset)dataset;

   10

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

   10

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

   11

       int itemCount = dataset.getItemCount(series);

   11

       int itemCount = dataset.getItemCount(series);

   12

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

   12

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

   13

       double delta = vdataset.getVectorXValue(series, item);

   13 | double delta = vdataset.getVectorXValue(series, item);
   13 | double delta = vdataset.getVectorYValue(series, item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getVectorXValue | getVectorYValue | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression vdataset.getVectorXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression vdataset.getVectorYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   13

       double delta = vdataset.getVectorYValue(series, item);

   14

       if (delta < 0.0)

   14

       if (delta < 0.0)

   15

       uvalue = vdataset.getXValue(series, item);

   15 | uvalue = vdataset.getXValue(series, item);
   15 | uvalue = vdataset.getYValue(series, item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getXValue | getYValue | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression vdataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression vdataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   15

       uvalue = vdataset.getYValue(series, item);

   16

       lvalue = uvalue + delta;

   16

       lvalue = uvalue + delta;

       else

       else

   17

       lvalue = vdataset.getXValue(series, item);

   17 | lvalue = vdataset.getXValue(series, item);
   17 | lvalue = vdataset.getYValue(series, item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getXValue | getYValue | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression vdataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression vdataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   17

       lvalue = vdataset.getYValue(series, item);

   18

       uvalue = lvalue + delta;

   18

       uvalue = lvalue + delta;

   19

       minimum = Math.min(minimum, lvalue);

   19

       minimum = Math.min(minimum, lvalue);

   20

       maximum = Math.max(maximum, uvalue);

   20

       maximum = Math.max(maximum, uvalue);

       else

       else

   21

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

   21

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

   22

       int itemCount = dataset.getItemCount(series);

   22

       int itemCount = dataset.getItemCount(series);

   23

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

   23

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

   24

       lvalue = dataset.getXValue(series, item);

   24 | lvalue = dataset.getXValue(series, item);
   24 | lvalue = dataset.getYValue(series, item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getXValue | getYValue | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression dataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression dataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   24

       lvalue = dataset.getYValue(series, item);

   25

       uvalue = lvalue;

   25

       uvalue = lvalue;

   26

       minimum = Math.min(minimum, lvalue);

   26

       minimum = Math.min(minimum, lvalue);

   27

       maximum = Math.max(maximum, uvalue);

   27

       maximum = Math.max(maximum, uvalue);

   Precondition Violations (9)
   Row | Violation
   --- | ---
   1 | Expression vdataset.getVectorXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression vdataset.getVectorYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression vdataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression vdataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression vdataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression vdataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression dataset.getXValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression dataset.getYValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Clone fragment #1 returns variables minimum, maximum , while Clone fragment #2 returns variables minimum, maximum