1100-3-4

Number value; if (dataset instanceof IntervalCategoryDataset) { IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset; value = icd.getStartValue(series, item); } else { value = dataset.getValue(series, item); } if (value != null) { minimum = Math.min(minimum, value.doubleValue()); }
Number value; if (dataset instanceof IntervalCategoryDataset) { IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset; value = icd.getEndValue(series, item); } else { value = dataset.getValue(series, item); } if (value != null) { maximum = Math.max(maximum, value.doubleValue()); }

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: `Number findMinimumRangeValue(CategoryDataset)` |  | Method name: `Number findMaximumRangeValue(CategoryDataset)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    Number value;↵

1

    Number value;↵

2

                        if (dataset instanceof IntervalCategoryDataset) {↵

2

                        if (dataset instanceof IntervalCategoryDataset) {↵

3

                            IntervalCategoryDataset icd↵

3

                            IntervalCategoryDataset icd↵

4

                                = (IntervalCategoryDataset) dataset;↵

4

                                = (IntervalCategoryDataset) dataset;↵

5

                            value = icd.getStartValue(series, item);↵

5

                            value = icd.getEndValue(series, item);↵

6

                        }↵

6

                        }↵

7

                        else {↵

7

                        else {↵

8

                            value = dataset.getValue(series, item);↵

8

                            value = dataset.getValue(series, item);↵

9

                        }↵

9

                        }↵

10

                        if (value != null) {↵

10

                        if (value != null) {↵

11

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

11

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

12

                        }

12

                        }

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

1. {Non-refactorable}

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

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

   11

       Number value;

   11

       Number value;

   12

       if (dataset instanceof IntervalCategoryDataset)

   12

       if (dataset instanceof IntervalCategoryDataset)

   13

       IntervalCategoryDataset icd = (IntervalCategoryDataset)dataset;

   13

       IntervalCategoryDataset icd = (IntervalCategoryDataset)dataset;

   14

       value = icd.getStartValue(series, item);

   14 | value = icd.getStartValue(series, item);
   14 | value = icd.getEndValue(series, item);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getStartValue | getEndValue | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression icd.getStartValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression icd.getEndValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   14

       value = icd.getEndValue(series, item);

       else

       else

   15

       value = dataset.getValue(series, item);

   15

       value = dataset.getValue(series, item);

   16

       if (value != null)

   16

       if (value != null)

   17

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

   17 | minimum = Math.min(minimum, value.doubleValue());
   17 | maximum = Math.max(maximum, value.doubleValue());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   minimum | maximum | VARIABLE_NAME_MISMATCH
   min | max | METHOD_INVOCATION_NAME_MISMATCH
   minimum | maximum | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression Math.min(minimum,value.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression Math.max(maximum,value.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   17

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

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression icd.getStartValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression icd.getEndValue(series,item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression Math.min(minimum,value.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression Math.max(maximum,value.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted