if (this.millisecond != LAST_MILLISECOND_IN_SECOND) { result = new Millisecond(this.millisecond + 1, getSecond()); } else { Second next = (Second) getSecond().next(); if (next != null) { result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next); } }
if (this.second != LAST_SECOND_IN_MINUTE) { result = new Second(this.second + 1, getMinute()); } else { Minute next = (Minute) getMinute().next(); if (next != null) { result = new Second(FIRST_SECOND_IN_MINUTE, next); } }
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 next() Method name: RegularTimePeriod next()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (this.millisecond != LAST_MILLISECOND_IN_SECOND) {
1
if (this.second != LAST_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 next = (Second) getSecond().next();
5
            Minute next = (Minute) getMinute().next();
6
            if (next != null) {
6
            if (next != null) {
7
                result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
7
                result = new Second(FIRST_SECOND_IN_MINUTE, next);
8
            }
8
            }
9
        }
9
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    Second next = (Second)getSecond().next();
    4
    Second next = (Second)getSecond().next();
    4
    Minute next = (Minute)getMinute().next();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Secondorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Secondorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Secondorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    getSecondgetMinuteMETHOD_INVOCATION_NAME_MISMATCH
    4
    Minute next = (Minute)getMinute().next();
    5
    if (next != null)
    5
    if (next != null)
    5
    if (next != null)
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Secondorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    5
    if (next != null)
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    6
    result = new Second(FIRST_SECOND_IN_MINUTE, next);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.RegularTimePeriodorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Millisecondorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    FIRST_MILLISECOND_IN_SECONDFIRST_SECOND_IN_MINUTEVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Secondorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new Millisecond(FIRST_MILLISECOND_IN_SECOND,next) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Second(FIRST_SECOND_IN_MINUTE,next) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    result = new Second(FIRST_SECOND_IN_MINUTE, next);
    Precondition Violations (3)
    Row Violation
    1Expression new Millisecond(FIRST_MILLISECOND_IN_SECOND,next) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new Second(FIRST_SECOND_IN_MINUTE,next) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Clone 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