if (obj instanceof Tick) { Tick t = (Tick) obj; if (!ObjectUtilities.equal(this.text, t.text)) { return false; } if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) { return false; } if (!(this.angle == t.angle)) { return false; } return true; }
if (obj == this) { return true; } if (!(obj instanceof DefaultBoxAndWhiskerXYDataset)) { return false; } DefaultBoxAndWhiskerXYDataset that = (DefaultBoxAndWhiskerXYDataset) obj; if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey)) { return false; } if (!this.dates.equals(that.dates)) { return false; } if (!this.items.equals(that.items)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/Tick.java File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/DefaultBoxAndWhiskerXYDataset.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 11 Number of AST nodes: 12
1
if (obj instanceof Tick) {
1
if (obj == this) {
2
            Tick t = (Tick) obj;
2
            return true;
3
   
3
        }
4
            if (!ObjectUtilities.equal(this.text, t.text)) {
4
        if (!(obj instanceof DefaultBoxAndWhiskerXYDataset)) {
5
                return false;   
5
            return false;
6
            }
7
    
6
        }
7
        DefaultBoxAndWhiskerXYDataset that 
8
                = (DefaultBoxAndWhiskerXYDataset) obj;
8
        if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) {
9
        if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey)) {
9
                return false;   
10
            return false;
10
            }
11
        
11
   
12
}
12
         if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) {
13
        if (!this.dates.equals(that.dates)) {
13
                return false;   
14
            return false;
14
            }
15
        
15
   
16
}
16
         if (!(this.angle == t.angle)) {
17
        if (!this.items.equals(that.items)) {
17
                return false;   
18
            return false;
18
  
19
          }
19
        }
20
            return true;
20
        return true;
21
        }
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)2.0
Clones locationClones are in different classes
Number of node comparisons51
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    Tick t = (Tick)obj;
                                            
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    6
    if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey))
    Differences
    Expression1Expression2Difference
    textseriesKeyVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    tthatVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.Tickorg.jfree.data.statistics.DefaultBoxAndWhiskerXYDatasetVARIABLE_TYPE_MISMATCH
    textseriesKeyVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable this.text does not match with type java.lang.Comparable of variable this.seriesKey
    • Make classes java.lang.String and java.lang.Comparable extend a common superclass
    Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.text does not match with type java.lang.Comparable of variable that.seriesKey
    • Make classes org.jfree.chart.axis.Tick and org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset extend a common superclass
    Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.text does not match with type java.lang.Comparable of variable that.seriesKey
    • Make classes java.lang.String and java.lang.Comparable extend a common superclass
    6
    if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey))
    6
    return false;
    7
    return false;
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    3
    if (!(obj instanceof DefaultBoxAndWhiskerXYDataset))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.textAnchor,t.textAnchor)(obj instanceof DefaultBoxAndWhiskerXYDataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.textAnchor,t.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!(obj instanceof DefaultBoxAndWhiskerXYDataset))
    8
    return false;
    4
    return false;
                                                                                                                                                      
    5
    DefaultBoxAndWhiskerXYDataset that = (DefaultBoxAndWhiskerXYDataset)obj;
    9
    if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))
    9
    if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))
    8
    if (!this.dates.equals(that.dates))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor)this.dates.equals(that.dates)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.dates.equals(that.dates) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!this.dates.equals(that.dates))
    10
    return false;
    9
    return false;
    11
    if (!(this.angle == t.angle))
    11
    if (!(this.angle == t.angle))
    10
    if (!this.items.equals(that.items))
    Differences
    Expression1Expression2Difference
    (this.angle == t.angle)this.items.equals(that.items)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (this.angle == t.angle) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.items.equals(that.items) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.items.equals(that.items))
    12
    return false;
    11
    return false;
    Precondition Violations (13)
    Row Violation
    1Type java.lang.String of variable this.text does not match with type java.lang.Comparable of variable this.seriesKey
    2Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable t.text does not match with type java.lang.Comparable of variable that.seriesKey
    5Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.lang.String of variable t.text does not match with type java.lang.Comparable of variable that.seriesKey
    8Expression ObjectUtilities.equal(this.textAnchor,t.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression this.dates.equals(that.dates) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression (this.angle == t.angle) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression this.items.equals(that.items) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Not all possible execution flows end in a return statement