if (obj != null) { if (obj instanceof Month) { Month target = (Month) obj; return (this.month == target.getMonth() && (this.year == target.getYearValue())); } else { return false; } } else { return false; }
if (obj != null) { if (obj instanceof Quarter) { Quarter target = (Quarter) obj; return (this.quarter == target.getQuarter() && (this.year == target.getYearValue())); } else { return false; } } else { return false; }
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: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (obj != null) {
1
if (obj != null) {
2
            if (obj instanceof Month) {
2
            if (obj instanceof Quarter) {
3
                Month target = (Month) obj;
3
                Quarter target = (Quarter) obj;
4
                return (this.month == target.getMonth() 
4
                return (this.quarter == target.getQuarter()
5
                        && (this.year == target.getYearValue()));
5
                        && (this.year == target.getYearValue()));
6
            }
6
            }
7
            else {
7
            else {
8
                return false;
8
                return false;
9
            }
9
            }
10
        }
10
        }
11
        else {
11
        else {
12
            return false;
12
            return false;
13
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj != null)
    1
    if (obj != null)
    2
    if (obj instanceof Month)
    2
    if (obj instanceof Month)
    2
    if (obj instanceof Quarter)
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression obj instanceof Month cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression obj instanceof Quarter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (obj instanceof Quarter)
    3
    Month target = (Month)obj;
    3
    Month target = (Month)obj;
    3
    Quarter target = (Quarter)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Monthorg.jfree.data.time.QuarterSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (Month)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (Quarter)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    Quarter target = (Quarter)obj;
                                                                                                                                                                                    
    4
    return (this.quarter == target.getQuarter() && (this.year == target.getYearValue()));
    4
    return (this.month == target.getMonth() && (this.year == target.getYearValue()));
                                                                                                                                                                            
    else
    else
    5
    return false;
    5
    return false;
    else
    else
    6
    return false;
    6
    return false;
    Precondition Violations (5)
    Row Violation
    1Expression obj instanceof Month cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression obj instanceof Quarter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression (Month)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression (Quarter)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variable target with type org.jfree.data.time.Month , while Clone fragment #2 returns variable target with type org.jfree.data.time.Quarter