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;
Second result = null; 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); } } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Minute.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Second.java
Method name: RegularTimePeriod next() Method name: RegularTimePeriod previous()
Number of AST nodes: 8 Number of AST nodes: 7
1
Minute result;
1
Second result = null;
2
        if (this.minute != LAST_MINUTE_IN_HOUR) {
2
        if (this.second != FIRST_SECOND_IN_MINUTE) {
3
            result = new Minute(this.minute + 1, getHour());
3
            result = new Second(this.second - 1, getMinute());
4
        }
4
        }
5
        else { // we are at the last minute in the hour...
5
        else {
6
            Hour nextHour = (Hour) getHour().next();
6
            Minute previous = (Minute) getMinute().previous();
7
            if (nextHour != null) {
7
            if (previous != null) {
8
                result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour);
8
                result = new 
9
            }
10
            else {
11
                result = null;
9
Second(LAST_SECOND_IN_MINUTE, previous);
12
            }
10
            }
13
        }
11
        }
14
        return result;
12
        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 statements4
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)10.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                
    1
    Second result = null;
    1
    Minute result;
                                      
    2
    if (this.minute != LAST_MINUTE_IN_HOUR)
    2
    if (this.minute != LAST_MINUTE_IN_HOUR)
    2
    if (this.second != FIRST_SECOND_IN_MINUTE)
    Differences
    Expression1Expression2Difference
    minutesecondVARIABLE_NAME_MISMATCH
    LAST_MINUTE_IN_HOURFIRST_SECOND_IN_MINUTEVARIABLE_NAME_MISMATCH
    2
    if (this.second != FIRST_SECOND_IN_MINUTE)
    3
    result = new Minute(this.minute + 1, getHour());
    3
    result = new Minute(this.minute + 1, getHour());
    3
    result = new Second(this.second - 1, getMinute());
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Minuteorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Minuteorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    minutesecondVARIABLE_NAME_MISMATCH
    +-OPERATOR_MISMATCH
    getHourgetMinuteMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Hour getHour() , public org.jfree.data.time.Minute getMinute()
    Expression new Minute(this.minute + 1,getHour()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Second(this.second - 1,getMinute()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Minute(this.minute + 1,getHour()) cannot be unified with expression new Second(this.second - 1,getMinute()) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Hour getHour() , public org.jfree.data.time.Minute getMinute()
    Expression this.minute + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.second - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression getHour() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getMinute() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3
    result = new Second(this.second - 1, getMinute());
    else
    else
    4
    Hour nextHour = (Hour)getHour().next();
    4
    Hour nextHour = (Hour)getHour().next();
    4
    Minute previous = (Minute)getMinute().previous();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Hourorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    nextHourpreviousVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.MinuteSUBCLASS_TYPE_MISMATCH
    nextpreviousMETHOD_INVOCATION_NAME_MISMATCH
    getHourgetMinuteMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression (Hour)getHour().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression (Minute)getMinute().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getHour().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getMinute().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getHour() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression getMinute() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4
    Minute previous = (Minute)getMinute().previous();
                                                  
    5
    if (previous != null)
    Preondition Violations
    Unmatched statement if(previous != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    if (previous != null)
                                                                                                              
    6
    result = new Second(LAST_SECOND_IN_MINUTE, previous);
    Preondition Violations
    Unmatched statement result=new Second(LAST_SECOND_IN_MINUTE,previous); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    result = new Second(LAST_SECOND_IN_MINUTE, previous);
    5
    if (nextHour != null)
    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
                                                  
    6
    result = new Minute(FIRST_MINUTE_IN_HOUR, nextHour);
    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
                                                                                                            
    else
            
    7
    result = null;
                                  
    8
    return result;
    8
    return result;
    7
    return result;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Minuteorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    7
    return result;
    Precondition Violations (19)
    Row Violation
    1Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Hour getHour() , public org.jfree.data.time.Minute getMinute()
    2Expression new Minute(this.minute + 1,getHour()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Second(this.second - 1,getMinute()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Minute(this.minute + 1,getHour()) cannot be unified with expression new Second(this.second - 1,getMinute()) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Hour getHour() , public org.jfree.data.time.Minute getMinute()
    5Expression this.minute + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression this.second - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression getHour() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8Expression getMinute() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    9Expression (Hour)getHour().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    10Expression (Minute)getMinute().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    11Expression getHour().next() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    12Expression getMinute().previous() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    13Expression getHour() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    14Expression getMinute() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    15Unmatched statement if(previous != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched statement result=new Second(LAST_SECOND_IN_MINUTE,previous); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Unmatched statement if(nextHour != null) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18Unmatched 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
    19Clone fragment #1 returns variable nextHour with type org.jfree.data.time.Hour , while Clone fragment #2 returns variable previous with type org.jfree.data.time.Minute