if (obj == null) { return false; } if (!(obj instanceof CategoryMarker)) { return false; } if (!super.equals(obj)) { return false; } CategoryMarker that = (CategoryMarker) obj; if (!this.key.equals(that.key)) { return false; } if (this.drawAsLine != that.drawAsLine) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof SlidingCategoryDataset)) { return false; } SlidingCategoryDataset that = (SlidingCategoryDataset) obj; if (this.firstCategoryIndex != that.firstCategoryIndex) { return false; } if (this.maximumCategoryCount != that.maximumCategoryCount) { return false; } if (!this.underlying.equals(that.underlying)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryMarker.java File path: /jfreechart-1.0.10/src/org/jfree/data/category/SlidingCategoryDataset.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (obj == null) {
1
if (obj == this) {
2
            return false;
3
        }
4
        
2
			return true;
3
		}
5
if (!(obj instanceof CategoryMarker)) {
4
		if (!(obj instanceof SlidingCategory
6
            return false;
7
        }
8
        if (!super.equals(obj)) {
9
            return false;
10
        }
11
        
5
Dataset)) {
6
			return false;
7
		}
12
CategoryMarker that = (CategoryMarker) obj;
8
		SlidingCategoryDataset that = (SlidingCategoryDataset) obj;
13
        if (!this.key.equals(that.key)) {
9
		if (this.
14
            return false;
15
        }
16
        
10
firstCategoryIndex != that.firstCategoryIndex) {
11
			return false;
12
		}
13
		if (this.maximumCategoryCount != that.maximumCategoryCount) {
14
			return false;
15
		}
17
if (this.drawAsLine != that.drawAsLine) {
16
		if (!this.
18
            return false;
19
        }
20
        
17
underlying.equals(that.underlying)) {
18
			return false;
19
		}
21
return true;
20
		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.6
Clones locationClones are in different classes
Number of node comparisons44
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.2
    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 instanceof CategoryMarker))
    3
    if (!(obj instanceof CategoryMarker))
    3
    if (!(obj instanceof SlidingCategoryDataset))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.data.category.SlidingCategoryDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.CategoryMarker does not match with type org.jfree.data.category.SlidingCategoryDataset
    • Make classes org.jfree.chart.plot.CategoryMarker and org.jfree.data.category.SlidingCategoryDataset extend a common superclass
    3
    if (!(obj instanceof SlidingCategoryDataset))
    4
    return false;
    4
    return false;
                                                                                                                          
    5
    SlidingCategoryDataset that = (SlidingCategoryDataset)obj;
                                                                                                                      
    6
    if (this.firstCategoryIndex != that.firstCategoryIndex)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    10
    if (!this.underlying.equals(that.underlying))
    Differences
    Expression1Expression2Difference
    super.equals(obj)this.underlying.equals(that.underlying)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.underlying.equals(that.underlying) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call if(!super.equals(obj)) cannot be extracted from method
    10
    if (!this.underlying.equals(that.underlying))
    6
    return false;
    11
    return false;
    7
    CategoryMarker that = (CategoryMarker)obj;
                                                                                          
    8
    if (!this.key.equals(that.key))
                                                                      
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (this.drawAsLine != that.drawAsLine)
    10
    if (this.drawAsLine != that.drawAsLine)
    8
    if (this.maximumCategoryCount != that.maximumCategoryCount)
    Differences
    Expression1Expression2Difference
    drawAsLinemaximumCategoryCountVARIABLE_NAME_MISMATCH
    booleanintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryMarkerorg.jfree.data.category.SlidingCategoryDatasetVARIABLE_TYPE_MISMATCH
    drawAsLinemaximumCategoryCountVARIABLE_NAME_MISMATCH
    booleanintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable this.drawAsLine does not match with type int of variable this.maximumCategoryCount
    Type boolean of variable that.drawAsLine does not match with type int of variable that.maximumCategoryCount
    • Make classes org.jfree.chart.plot.CategoryMarker and org.jfree.data.category.SlidingCategoryDataset extend a common superclass
    Expression that.drawAsLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.maximumCategoryCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type boolean of variable that.drawAsLine does not match with type int of variable that.maximumCategoryCount
    8
    if (this.maximumCategoryCount != that.maximumCategoryCount)
    11
    return false;
    9
    return false;
    Precondition Violations (11)
    Row Violation
    1Type org.jfree.chart.plot.CategoryMarker does not match with type org.jfree.data.category.SlidingCategoryDataset
    2Unmatched return false;
    3Expression this.underlying.equals(that.underlying) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Super method call if(!super.equals(obj)) cannot be extracted from method
    5Unmatched return false;
    6Type boolean of variable this.drawAsLine does not match with type int of variable this.maximumCategoryCount
    7Type boolean of variable that.drawAsLine does not match with type int of variable that.maximumCategoryCount
    8Expression that.drawAsLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.maximumCategoryCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type boolean of variable that.drawAsLine does not match with type int of variable that.maximumCategoryCount
    11Not all possible execution flows end in a return statement