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; } }
if (this.week < actualMaxWeek) { result = new Week(this.week + 1, this.year); } else { if (this.year < 9999) { result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1); } else { result = null; } }
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/Week.java
Method name: RegularTimePeriod next() Method name: RegularTimePeriod next()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (this.month != MonthConstants.DECEMBER) {
1
if (this.week < actualMaxWeek) {
2
            result = new Month(this.month + 1, this.year);
2
                result = new Week(this.week + 1, this.year);
3
        }
3
            }
4
        else {
4
            else {
5
            if (this.year < 9999) {
5
                if (this.year < 9999) {
6
                result = new Month(MonthConstants.JANUARY, this.year + 1);
6
                    result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
7
            }
7
                }
8
            else {
8
                else {
9
                result = null;
9
                    result = null;
10
            }
10
            
11
    }
11
        }
12
            }
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    if (this.year < 9999)
    4
    if (this.year < 9999)
    9
    if (this.year < 9999)
    Differences
    Expression1Expression2Difference
    intshortVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable this.year does not match with type short of variable this.year
    9
    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 the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement result=new Month(MonthConstants.JANUARY,this.year + 1); 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
                                                                                                                        
                                                                                                                
    10
    result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
    Preondition Violations
    Unmatched statement result=new Week(FIRST_WEEK_IN_YEAR,this.year + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement result=new Week(FIRST_WEEK_IN_YEAR,this.year + 1); 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
    10
    result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
    else
    else
    6
    result = null;
    6
    result = null;
    11
    result = null;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Monthorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    11
    result = null;
    Precondition Violations (6)
    Row Violation
    1Type int of variable this.year does not match with type short of variable this.year
    2Unmatched statement result=new Month(MonthConstants.JANUARY,this.year + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement result=new Month(MonthConstants.JANUARY,this.year + 1); 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 Week(FIRST_WEEK_IN_YEAR,this.year + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement result=new Week(FIRST_WEEK_IN_YEAR,this.year + 1); 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
    6Clone fragment #1 returns variable result with type org.jfree.data.time.Month , while Clone fragment #2 returns variable result with type org.jfree.data.time.Week