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; } }
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/Quarter.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Week.java
Method name: RegularTimePeriod previous() Method name: RegularTimePeriod next()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (this.quarter &gt; FIRST_QUARTER) {
1
if (this.week &lt; actualMaxWeek) {
2
            result = new Quarter(this.quarter - 1, this.year);
2
                result = new Week(this.week + 1, this.year);
3
        }
3
        
4
    }
4
        else {
5
            else {
5
            if (this.year &gt; 1900) {
6
                if (this.year &lt; 9999) {
6
                result = new Quarter(LAST_QUARTER, this.year - 1);
7
                    result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
7
            }
8
                }
8
            else {
9
                else {
9
                result = null;
10
                    result = null;
10
            }
11
            
12
    }
11
        }
13
            }
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (this.quarter > FIRST_QUARTER)
    2
    if (this.quarter > FIRST_QUARTER)
    7
    if (this.week < actualMaxWeek)
    Differences
    Expression1Expression2Difference
    quarterweekVARIABLE_NAME_MISMATCH
    FIRST_QUARTERactualMaxWeekVARIABLE_NAME_MISMATCH
    ><OPERATOR_MISMATCH
    7
    if (this.week < actualMaxWeek)
    3
    result = new Quarter(this.quarter - 1, this.year);
    3
    result = new Quarter(this.quarter - 1, this.year);
    8
    result = new Week(this.week + 1, this.year);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Quarterorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    quarterweekVARIABLE_NAME_MISMATCH
    -+OPERATOR_MISMATCH
    Preondition Violations
    Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    Expression new Quarter(this.quarter - 1,this.year) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Week(this.week + 1,this.year) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Quarter(this.quarter - 1,this.year) cannot be unified with expression new Week(this.week + 1,this.year) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    Expression this.quarter - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.week + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    result = new Week(this.week + 1, this.year);
    else
    else
    4
    if (this.year > 1900)
    4
    if (this.year > 1900)
    9
    if (this.year < 9999)
    Differences
    Expression1Expression2Difference
    19009999LITERAL_VALUE_MISMATCH
    ><OPERATOR_MISMATCH
    9
    if (this.year < 9999)
    5
    result = new Quarter(LAST_QUARTER, this.year - 1);
    5
    result = new Quarter(LAST_QUARTER, this.year - 1);
    10
    result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Quarterorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    LAST_QUARTERFIRST_WEEK_IN_YEARVARIABLE_NAME_MISMATCH
    -+OPERATOR_MISMATCH
    Preondition Violations
    Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    Expression new Quarter(LAST_QUARTER,this.year - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Week(FIRST_WEEK_IN_YEAR,this.year + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Quarter(LAST_QUARTER,this.year - 1) cannot be unified with expression new Week(FIRST_WEEK_IN_YEAR,this.year + 1) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    Expression this.year - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.year + 1 cannot be parameterized, because it has dependencies to/from statements 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.Quarterorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    11
    result = null;
    Precondition Violations (13)
    Row Violation
    1Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    2Expression new Quarter(this.quarter - 1,this.year) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Week(this.week + 1,this.year) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Quarter(this.quarter - 1,this.year) cannot be unified with expression new Week(this.week + 1,this.year) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    5Expression this.quarter - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression this.week + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression result cannot be unified with expression result , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    8Expression new Quarter(LAST_QUARTER,this.year - 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression new Week(FIRST_WEEK_IN_YEAR,this.year + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression new Quarter(LAST_QUARTER,this.year - 1) cannot be unified with expression new Week(FIRST_WEEK_IN_YEAR,this.year + 1) , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private short year
    11Expression this.year - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression this.year + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Clone fragment #1 returns variable result with type org.jfree.data.time.Quarter , while Clone fragment #2 returns variable result with type org.jfree.data.time.Week