Month result; if (this.month != MonthConstants.DECEMBER) { result = new Month(this.month + 1, this.year); } else { if (this.year < 9999) { result = new Month(MonthConstants.JANUARY, this.year + 1); } else { result = null; } } return result;
Quarter result; if (this.quarter > FIRST_QUARTER) { result = new Quarter(this.quarter - 1, this.year); } else { if (this.year > 1900) { result = new Quarter(LAST_QUARTER, this.year - 1); } else { result = null; } } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Month.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Quarter.java
Method name: RegularTimePeriod next() Method name: RegularTimePeriod previous()
Number of AST nodes: 7 Number of AST nodes: 7
1
Month result;
1
Quarter result;
2
        if (this.month != MonthConstants.DECEMBER) {
2
        if (this.quarter > FIRST_QUARTER) {
3
            result = new Month(this.month + 1, this.year);
3
            result = new Quarter(this.quarter - 1, this.year);
4
        }
4
        }
5
        else {
5
        else {
6
            if (this.year &lt; 9999) {
6
            if (this.year &gt; 1900) {
7
                result = new Month(MonthConstants.JANUARY, this.year + 1);
7
                result = new Quarter(LAST_QUARTER, this.year - 1);
8
            }
8
            }
9
            else {
9
            else {
10
                result = null;
10
                result = null;
11
            }
11
            }
12
        }
12
        }
13
        return result;
13
        return result;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
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 comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Month result;
    1
    Month result;
    1
    Quarter result;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    1
    Quarter result;
                                                                          
    2
    if (this.quarter > FIRST_QUARTER)
                                                                                                        
    3
    result = new Quarter(this.quarter - 1, this.year);
    Preondition Violations
    Unmatched statement result=new Quarter(this.quarter - 1,this.year); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result = new Quarter(this.quarter - 1, this.year);
                                                  
    4
    if (this.year > 1900)
                                                                                                        
    5
    result = new Quarter(LAST_QUARTER, this.year - 1);
    Preondition Violations
    Unmatched statement result=new Quarter(LAST_QUARTER,this.year - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    result = new Quarter(LAST_QUARTER, this.year - 1);
            
    else
                                  
    6
    result = null;
    Preondition Violations
    Unmatched statement result=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    result = null;
    2
    if (this.month != MonthConstants.DECEMBER)
                                                                                            
    3
    result = new Month(this.month + 1, this.year);
    3
    result = new Month(this.month + 1, this.year);
    Preondition Violations
    Unmatched statement result=new Month(this.month + 1,this.year); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    4
    if (this.year < 9999)
                                                  
    5
    result = new Month(MonthConstants.JANUARY, this.year + 1);
    5
    result = new Month(MonthConstants.JANUARY, this.year + 1);
    Preondition Violations
    Unmatched statement result=new Month(MonthConstants.JANUARY,this.year + 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                        
    else
            
    6
    result = null;
    6
    result = null;
    Preondition Violations
    Unmatched statement result=null; 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;
    7
    return result;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    7
    return result;
    Precondition Violations (6)
    Row Violation
    1Unmatched statement result=new Quarter(this.quarter - 1,this.year); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement result=new Quarter(LAST_QUARTER,this.year - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement result=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement result=new Month(this.month + 1,this.year); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement result=new Month(MonthConstants.JANUARY,this.year + 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement result=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted