1501-1-3

if (this.millisecond != FIRST_MILLISECOND_IN_SECOND) { result = new Millisecond(this.millisecond - 1, getSecond()); } else { Second previous = (Second) getSecond().previous(); if (previous != null) { result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous); } }
if (this.second != FIRST_SECOND_IN_MINUTE) { result = new Second(this.second - 1, getMinute()); } else { Minute previous = (Minute) getMinute().previous(); if (previous != null) { result = new Second(LAST_SECOND_IN_MINUTE, previous); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Millisecond.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/time/Second.java
Method name: `RegularTimePeriod previous()` |  | Method name: `RegularTimePeriod previous()`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (this.millisecond != FIRST_MILLISECOND_IN_SECOND) {↵

1

    if (this.second != FIRST_SECOND_IN_MINUTE) {↵

2

                result = new Millisecond(this.millisecond - 1, getSecond());↵

2

                result = new Second(this.second - 1, getMinute());↵

3

            }↵

3

            }↵

4

            else {↵

4

            else {↵

5

                Second previous = (Second) getSecond().previous();↵

5

                Minute previous = (Minute) getMinute().previous();↵

6

                if (previous != null) {↵

6

                if (previous != null) {↵

7

                    result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);↵

7

                    result = new Second(LAST_SECOND_IN_MINUTE, previous);↵

8

                }↵

8

                }↵

9

            }

9

            }

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 in different classes having the same super class
Number of node comparisons | 13

1. {Non-refactorable}

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

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

   2

       if (this.millisecond != FIRST_MILLISECOND_IN_SECOND)

   2 | if (this.millisecond != FIRST_MILLISECOND_IN_SECOND)
   2 | if (this.second != FIRST_SECOND_IN_MINUTE)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   millisecond | second | VARIABLE_NAME_MISMATCH
   int | byte | VARIABLE_TYPE_MISMATCH
   FIRST_MILLISECOND_IN_SECOND | FIRST_SECOND_IN_MINUTE | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Type int of variable this.millisecond does not match with type byte of variable this.second

   2

       if (this.second != FIRST_SECOND_IN_MINUTE)

   3

       result = new Second(this.second - 1, getMinute());

   3

       result = new Millisecond(this.millisecond - 1, getSecond());

       else

       else

   4

       Second previous = (Second)getSecond().previous();

   4 | Second previous = (Second)getSecond().previous();
   4 | Minute previous = (Minute)getMinute().previous();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Second | org.jfree.data.time.Minute | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Second | org.jfree.data.time.Minute | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Second | org.jfree.data.time.Minute | SUBCLASS_TYPE_MISMATCH
   getSecond | getMinute | METHOD_INVOCATION_NAME_MISMATCH

   4

       Minute previous = (Minute)getMinute().previous();

   5

       if (previous != null)

   5 | if (previous != null)
   5 | if (previous != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Second | org.jfree.data.time.Minute | SUBCLASS_TYPE_MISMATCH

   5

       if (previous != null)

   6

       result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);

   6 | result = new Millisecond(LAST_MILLISECOND_IN_SECOND, previous);
   6 | result = new Second(LAST_SECOND_IN_MINUTE, previous);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.RegularTimePeriod | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Second | SUBCLASS_TYPE_MISMATCH
   LAST_MILLISECOND_IN_SECOND | LAST_SECOND_IN_MINUTE | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Second | org.jfree.data.time.Minute | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression new Millisecond(LAST_MILLISECOND_IN_SECOND,previous) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Second(LAST_SECOND_IN_MINUTE,previous) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       result = new Second(LAST_SECOND_IN_MINUTE, previous);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Type int of variable this.millisecond does not match with type byte of variable this.second
   2 | Expression new Millisecond(LAST_MILLISECOND_IN_SECOND,previous) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression new Second(LAST_SECOND_IN_MINUTE,previous) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Clone fragment #1 returns variable result with type org.jfree.data.time.RegularTimePeriod , while Clone fragment #2 returns variable result with type org.jfree.data.time.Second