RegularTimePeriod result = null; 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); } } return result;
Minute result; if (this.minute != LAST_MINUTE_IN_HOUR) { result = new Minute(this.minute + 1, getHour()); } else { // we are at the last minute in the hour... Hour nextHour = (Hour) getHour().next(); if (nextHour != null) { result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour); } else { result = null; } } return result;
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/Minute.java
Method name: RegularTimePeriod next() Method name: RegularTimePeriod next()
Number of AST nodes: 7 Number of AST nodes: 8
1
RegularTimePeriod result = null;
1
Minute result;
2
        if (this.millisecond != LAST_MILLISECOND_IN_SECOND) {
2
        if (this.minute != LAST_MINUTE_IN_HOUR) {
3
            result = new Millisecond(this.millisecond + 1, getSecond());
3
            result = new Minute(this.minute + 1, getHour());
4
        }
4
        }
5
        else {
5
        else { // we are at the last minute in the hour...
6
            Second next = (Second) getSecond().next();
6
            Hour nextHour = (Hour) getHour().next();
7
            if (next != null) {
7
            if (nextHour != null) {
8
                result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next)
8
                result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour);
9
            }
10
            else {
9
;
11
                result = null;
10
            }
12
            }
11
        }
13
        }
12
        return result;
14
        return result;
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 comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)8.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                      
    1
    Minute result;
    1
    RegularTimePeriod result = null;
                                                                      
    2
    if (this.millisecond != LAST_MILLISECOND_IN_SECOND)
    2
    if (this.millisecond != LAST_MILLISECOND_IN_SECOND)
    2
    if (this.minute != LAST_MINUTE_IN_HOUR)
    Differences
    Expression1Expression2Difference
    millisecondminuteVARIABLE_NAME_MISMATCH
    intbyteVARIABLE_TYPE_MISMATCH
    LAST_MILLISECOND_IN_SECONDLAST_MINUTE_IN_HOURVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable this.millisecond does not match with type byte of variable this.minute
    2
    if (this.minute != LAST_MINUTE_IN_HOUR)
                                                                                                    
    3
    result = new Minute(this.minute + 1, getHour());
    Preondition Violations
    Unmatched statement result=new Minute(this.minute + 1,getHour()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement result=new Minute(this.minute + 1,getHour()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3
    result = new Minute(this.minute + 1, getHour());
    3
    result = new Millisecond(this.millisecond + 1, getSecond());
    3
    result = new Millisecond(this.millisecond + 1, getSecond());
    Preondition Violations
    Unmatched statement result=new Millisecond(this.millisecond + 1,getSecond()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement result=new Millisecond(this.millisecond + 1,getSecond()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                            
    else
    else
    4
    Second next = (Second)getSecond().next();
    4
    Second next = (Second)getSecond().next();
    4
    Hour nextHour = (Hour)getHour().next();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Secondorg.jfree.data.time.HourSUBCLASS_TYPE_MISMATCH
    nextnextHourVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Secondorg.jfree.data.time.HourSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Secondorg.jfree.data.time.HourSUBCLASS_TYPE_MISMATCH
    getSecondgetHourMETHOD_INVOCATION_NAME_MISMATCH
    4
    Hour nextHour = (Hour)getHour().next();
                                                  
    5
    if (nextHour != null)
    Preondition Violations
    Unmatched statement if(nextHour != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    if (nextHour != null)
                                                                                                            
    6
    result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour);
    Preondition Violations
    Unmatched statement result=new Minute(FIRST_MINUTE_IN_HOUR,nextHour); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour);
            
    else
                                  
    7
    result = null;
    5
    if (next != null)
    5
    if (next != null)
    Preondition Violations
    Unmatched statement if(next != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    6
    result = new Millisecond(FIRST_MILLISECOND_IN_SECOND, next);
    Preondition Violations
    Unmatched statement result=new Millisecond(FIRST_MILLISECOND_IN_SECOND,next); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    7
    return result;
    7
    return result;
    8
    return result;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.RegularTimePeriodorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    8
    return result;
    Precondition Violations (10)
    Row Violation
    1Type int of variable this.millisecond does not match with type byte of variable this.minute
    2Unmatched statement result=new Minute(this.minute + 1,getHour()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement result=new Minute(this.minute + 1,getHour()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched statement result=new Millisecond(this.millisecond + 1,getSecond()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement result=new Millisecond(this.millisecond + 1,getSecond()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement if(nextHour != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement result=new Minute(FIRST_MINUTE_IN_HOUR,nextHour); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement if(next != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement result=new Millisecond(FIRST_MILLISECOND_IN_SECOND,next); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Clone fragment #1 returns variable next with type org.jfree.data.time.Second , while Clone fragment #2 returns variable nextHour with type org.jfree.data.time.Hour