if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof HistogramType)) { return false; } HistogramType t = (HistogramType) obj; if (!this.name.equals(t.name)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof Hour)) { return false; } Hour that = (Hour) obj; if (this.hour != that.hour) { return false; } if (!this.day.equals(that.day)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/HistogramType.java File path: /jfreechart-1.0.10/src/org/jfree/data/time/Hour.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (obj == null) {
1
if (obj == this) {
2
            return false;   
2
            return true;
3
        }
3
        }
4
        
5
        if (obj == this) {
4
        if (!(obj instanceof Hour)) {
6
            return true;
5
            return false;
7
        }
6
        }
8
        
7
        
9
        if (!(obj instanceof HistogramType)) {
10
            return false;
11
        }
12
        
13
        HistogramType t = (HistogramType) obj;
8
Hour that = (Hour) obj;
9
        if (this.hour != that.hour) {
10
            return false;
11
        }
14
        if (!this.name.equals(t.name)) {
12
        if (!this.day.equals(that.day)) {
15
            return false;
13
            return false;
16
        }
14
        }
17
        
18
        return true;
15
        return true;
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)1.1
Clones locationClones are in different classes
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == null)
    1
    if (obj == null)
    1
    if (obj == this)
    Differences
    Expression1Expression2Difference
    nullthisTYPE_COMPATIBLE_REPLACEMENT
    1
    if (obj == this)
    2
    return false;
    2
    return false;
    2
    return true;
    Differences
    Expression1Expression2Difference
    falsetrueLITERAL_VALUE_MISMATCH
    2
    return true;
    3
    if (obj == this)
                                        
    4
    return true;
    4
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    5
    if (!(obj instanceof HistogramType))
    5
    if (!(obj instanceof HistogramType))
    3
    if (!(obj instanceof Hour))
    Differences
    Expression1Expression2Difference
    org.jfree.data.statistics.HistogramTypeorg.jfree.data.time.HourVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.statistics.HistogramType does not match with type org.jfree.data.time.Hour
    • Make classes org.jfree.data.statistics.HistogramType and org.jfree.data.time.Hour extend a common superclass
    3
    if (!(obj instanceof Hour))
    6
    return false;
    4
    return false;
                                                  
    5
    Hour that = (Hour)obj;
                                                              
    6
    if (this.hour != that.hour)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    7
    HistogramType t = (HistogramType)obj;
                                                                                
    8
    if (!this.name.equals(t.name))
    8
    if (!this.name.equals(t.name))
    8
    if (!this.day.equals(that.day))
    Differences
    Expression1Expression2Difference
    tthatVARIABLE_NAME_MISMATCH
    org.jfree.data.statistics.HistogramTypeorg.jfree.data.time.HourVARIABLE_TYPE_MISMATCH
    namedayVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jfree.data.time.DayVARIABLE_TYPE_MISMATCH
    namedayVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jfree.data.time.DayVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression t.name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.day cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.name does not match with type org.jfree.data.time.Day of variable that.day
    • Make classes org.jfree.data.statistics.HistogramType and org.jfree.data.time.Hour extend a common superclass
    Expression t.name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.day cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.name does not match with type org.jfree.data.time.Day of variable that.day
    • Make classes java.lang.String and org.jfree.data.time.Day extend a common superclass
    Type java.lang.String of variable this.name does not match with type org.jfree.data.time.Day of variable this.day
    • Make classes java.lang.String and org.jfree.data.time.Day extend a common superclass
    8
    if (!this.day.equals(that.day))
    9
    return false;
    9
    return false;
    Precondition Violations (11)
    Row Violation
    1Unmatched return true;
    2Type org.jfree.data.statistics.HistogramType does not match with type org.jfree.data.time.Hour
    3Unmatched return false;
    4Expression t.name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.day cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.String of variable t.name does not match with type org.jfree.data.time.Day of variable that.day
    7Expression t.name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.day cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.lang.String of variable t.name does not match with type org.jfree.data.time.Day of variable that.day
    10Type java.lang.String of variable this.name does not match with type org.jfree.data.time.Day of variable this.day
    11Not all possible execution flows end in a return statement