1068-1-2

Date result = null; Range range = getRange(); if (range instanceof DateRange) { DateRange r = (DateRange) range; result = r.getLowerDate(); } else { result = new Date((long) range.getLowerBound()); } return result;
Date result = null; Range range = getRange(); if (range instanceof DateRange) { DateRange r = (DateRange) range; result = r.getUpperDate(); } else { result = new Date((long) range.getUpperBound()); } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/DateAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/DateAxis.java
Method name: `Date getMinimumDate()` |  | Method name: `Date getMaximumDate()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    Date result = null;↵

1

    Date result = null;↵

2

            Range range = getRange();↵

2

            Range range = getRange();↵

3

            if (range instanceof DateRange) {↵

3

            if (range instanceof DateRange) {↵

4

                DateRange r = (DateRange) range;↵

4

                DateRange r = (DateRange) range;↵

5

                result = r.getLowerDate();↵

5

                result = r.getUpperDate();↵

6

            }↵

6

            }↵

7

            else {↵

7

            else {↵

8

                result = new Date((long) range.getLowerBound());↵

8

                result = new Date((long) range.getUpperBound());↵

9

            }↵

9

            }↵

10

            return result;

10

            return result;

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

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) | 0.9
   Clone type | Type 2

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

   1

       Date result = null;

   1

       Date result = null;

   2

       Range range = getRange();

   2

       Range range = getRange();

   3

       if (range instanceof DateRange)

   3

       if (range instanceof DateRange)

   4

       DateRange r = (DateRange)range;

   4

       DateRange r = (DateRange)range;

   5

       result = r.getLowerDate();

   5 | result = r.getLowerDate();
   5 | result = r.getUpperDate();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getLowerDate | getUpperDate | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression r.getLowerDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r.getUpperDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   5

       result = r.getUpperDate();

       else

       else

   6

       result = new Date((long)range.getLowerBound());

   6 | result = new Date((long)range.getLowerBound());
   6 | result = new Date((long)range.getUpperBound());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getLowerBound | getUpperBound | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression range.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression range.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       result = new Date((long)range.getUpperBound());

   7

       return result;

   7

       return result;

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression r.getLowerDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression r.getUpperDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression range.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression range.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted