if (obj == this) { return true; } if (!(obj instanceof CategoryAxis)) { return false; } if (!super.equals(obj)) { return false; } CategoryAxis that = (CategoryAxis) obj; if (that.lowerMargin != this.lowerMargin) { return false; } if (that.upperMargin != this.upperMargin) { return false; } if (that.categoryMargin != this.categoryMargin) { return false; } if (that.maximumCategoryLabelWidthRatio != this.maximumCategoryLabelWidthRatio) { return false; } if (that.categoryLabelPositionOffset != this.categoryLabelPositionOffset) { return false; } if (!ObjectUtilities.equal(that.categoryLabelPositions, this.categoryLabelPositions)) { return false; } if (!ObjectUtilities.equal(that.categoryLabelToolTips, this.categoryLabelToolTips)) { return false; } if (!ObjectUtilities.equal(this.tickLabelFontMap, that.tickLabelFontMap)) { return false; } if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof DefaultDrawingSupplier)) { return false; } DefaultDrawingSupplier that = (DefaultDrawingSupplier) obj; if (!Arrays.equals(this.paintSequence, that.paintSequence)) { return false; } if (this.paintIndex != that.paintIndex) { return false; } if (!Arrays.equals(this.outlinePaintSequence, that.outlinePaintSequence)) { return false; } if (this.outlinePaintIndex != that.outlinePaintIndex) { return false; } if (!Arrays.equals(this.strokeSequence, that.strokeSequence)) { return false; } if (this.strokeIndex != that.strokeIndex) { return false; } if (!Arrays.equals(this.outlineStrokeSequence, that.outlineStrokeSequence)) { return false; } if (this.outlineStrokeIndex != that.outlineStrokeIndex) { return false; } if (!equalShapes(this.shapeSequence, that.shapeSequence)) { return false; } if (this.shapeIndex != that.shapeIndex) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/DefaultDrawingSupplier.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 26 Number of AST nodes: 26
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof CategoryAxis)) {
4
        if (!(obj instanceof DefaultDrawingSupplier)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        if (!super.equals(obj)) {
7
        
8
            return false;
9
        }
10
        CategoryAxis that = (CategoryAxis) obj;
11
        if (that.lowerMargin != this.lowerMargin
8
DefaultDrawingSupplier that = (DefaultDrawingSupplier) obj;
9
        if (!Arrays.equals(this.paintSequence, that.paintSequence)) {
10
            return false;
11
        }
12
) {
12
        if (this.paintIndex != that.paintIndex) {
13
            return false;
13
            return false;   
14
        }
14
        }
15
        if (that.upperMargin != this.upperMargin
15
        if (!Arrays.equals(this.outlinePaintSequence, 
16
) {
16
                that.outlinePaintSequence)) {
17
            return false;
17
            return false;
18
        }
18
        }
19
        if (that.categoryMargin != this.categoryMargin) {
19
        if (this.outlinePaintIndex != that.outlinePaintIndex) {
20
            return false;
20
            return false;
21
        }
21
        }
22
        if (that.maximumCategoryLabelWidthRatio
22
        if (
23
                != this.maximumCategoryLabelWidthRatio) {
23
!Arrays.equals(this.strokeSequence, that.strokeSequence)) {
24
            return false;
24
            return false;
25
        }
25
        }
26
        if (that.categoryLabelPositionOffset
26
        if (th
27
                != this.categoryLabelPositionOffset) {
27
is.strokeIndex != that.strokeIndex) {
28
            return false;
28
            return false;   
29
        }
29
        }
30
        if (!ObjectUtilities.equal(that.categoryLabelPositions,
30
        if (!Arrays.equals(th
31
                this.categoryLabelPositions)) {
32
            return false;
33
        }
34
        if (!ObjectUtilities.equal(that.categoryLabelToolTips,
35
                this.categoryLabelToolTips)
31
is.outlineStrokeSequence, 
32
                that.outlineStrokeSequence)) {
33
            return false;
34
        }
36
) {
35
        if (this.outlineStrokeIndex != that.outlineStrokeIndex) {
37
            return false;
36
            return false;   
38
        }
37
        }
39
        if (!ObjectUtilities.equal(this.tickLabelFontMap,
38
        if (!
40
                that.tickLabelFontMap)) {
39
equalShapes(this.shapeSequence, that.shapeSequence)) {
41
            return false;
40
            return false;
42
        }
41
        }
43
        if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap)) {
42
        if (this.shapeIndex != that.shapeIndex) {
44
            return false;
43
            return false;
45
        }
44
        }
46
        return true;
45
        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)10.5
Clones locationClones are in different classes
Number of node comparisons205
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment15
    Number of unmapped statements in the second code fragment13
    Time elapsed for statement mapping (ms)9.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!(obj instanceof CategoryAxis))
    3
    if (!(obj instanceof CategoryAxis))
    3
    if (!(obj instanceof DefaultDrawingSupplier))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.plot.DefaultDrawingSupplierVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.axis.CategoryAxis does not match with type org.jfree.chart.plot.DefaultDrawingSupplier
    • Make classes org.jfree.chart.axis.CategoryAxis and org.jfree.chart.plot.DefaultDrawingSupplier extend a common superclass
    3
    if (!(obj instanceof DefaultDrawingSupplier))
    4
    return false;
    4
    return false;
                                                                                                                          
    5
    DefaultDrawingSupplier that = (DefaultDrawingSupplier)obj;
                                                                                                                            
    6
    if (!Arrays.equals(this.paintSequence, that.paintSequence))
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    22
    if (!equalShapes(this.shapeSequence, that.shapeSequence))
    Differences
    Expression1Expression2Difference
    super.equals(obj)equalShapes(this.shapeSequence,that.shapeSequence)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression equalShapes(this.shapeSequence,that.shapeSequence) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method equalShapes
    Super method call if(!super.equals(obj)) cannot be extracted from method
    22
    if (!equalShapes(this.shapeSequence, that.shapeSequence))
    6
    return false;
    23
    return false;
    7
    CategoryAxis that = (CategoryAxis)obj;
                                                                                  
                                                                                      
    8
    if (this.paintIndex != that.paintIndex)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    8
    if (that.lowerMargin != this.lowerMargin)
                                                                                          
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
                                                                                                                                                          
    10
    if (!Arrays.equals(this.outlinePaintSequence, that.outlinePaintSequence))
                                      
    11
    return false;
    Preondition Violations
    Unmatched return false;
    11
    return false;
    10
    if (that.upperMargin != this.upperMargin)
                                                                                            
    11
    return false;
    11
    return false;
    Preondition Violations
    Unmatched return false;
                                      
                                                                                                                    
    12
    if (this.outlinePaintIndex != that.outlinePaintIndex)
                                      
    13
    return false;
    Preondition Violations
    Unmatched return false;
    13
    return false;
    12
    if (that.categoryMargin != this.categoryMargin)
                                                                                                        
    13
    return false;
    13
    return false;
    Preondition Violations
    Unmatched return false;
                                      
                                                                                                                                  
    14
    if (!Arrays.equals(this.strokeSequence, that.strokeSequence))
                                      
    15
    return false;
    Preondition Violations
    Unmatched return false;
    15
    return false;
    14
    if (that.maximumCategoryLabelWidthRatio != this.maximumCategoryLabelWidthRatio)
                                                                                                                                                                        
    15
    return false;
    15
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    16
    if (that.categoryLabelPositionOffset != this.categoryLabelPositionOffset)
    16
    if (that.categoryLabelPositionOffset != this.categoryLabelPositionOffset)
    16
    if (this.strokeIndex != that.strokeIndex)
    Differences
    Expression1Expression2Difference
    that.categoryLabelPositionOffsetthis.strokeIndexTYPE_COMPATIBLE_REPLACEMENT
    this.categoryLabelPositionOffsetthat.strokeIndexTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression that.categoryLabelPositionOffset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.strokeIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (this.strokeIndex != that.strokeIndex)
    17
    return false;
    17
    return false;
    18
    if (!ObjectUtilities.equal(that.categoryLabelPositions, this.categoryLabelPositions))
                                                                                                                                                                                  
    19
    return false;
    19
    return false;
    Preondition Violations
    Unmatched return false;
                                      
                                                                                                                        
    20
    if (this.outlineStrokeIndex != that.outlineStrokeIndex)
                                      
    21
    return false;
    Preondition Violations
    Unmatched return false;
    21
    return false;
    20
    if (!ObjectUtilities.equal(that.categoryLabelToolTips, this.categoryLabelToolTips))
                                                                                                                                                                              
    21
    return false;
    21
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    22
    if (!ObjectUtilities.equal(this.tickLabelFontMap, that.tickLabelFontMap))
                                                                                                                                                          
    23
    return false;
    23
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    24
    if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap))
    24
    if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap))
    18
    if (!Arrays.equals(this.outlineStrokeSequence, that.outlineStrokeSequence))
    Differences
    Expression1Expression2Difference
    equalPaintMaps(this.tickLabelPaintMap,that.tickLabelPaintMap)Arrays.equals(this.outlineStrokeSequence,that.outlineStrokeSequence)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression equalPaintMaps(this.tickLabelPaintMap,that.tickLabelPaintMap) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method equalPaintMaps
    Expression Arrays.equals(this.outlineStrokeSequence,that.outlineStrokeSequence) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    if (!Arrays.equals(this.outlineStrokeSequence, that.outlineStrokeSequence))
    25
    return false;
    19
    return false;
    Precondition Violations (22)
    Row Violation
    1Type org.jfree.chart.axis.CategoryAxis does not match with type org.jfree.chart.plot.DefaultDrawingSupplier
    2Unmatched return false;
    3Expression equalShapes(this.shapeSequence,that.shapeSequence) 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;
    6Unmatched return false;
    7Unmatched return false;
    8Unmatched return false;
    9Unmatched return false;
    10Unmatched return false;
    11Unmatched return false;
    12Unmatched return false;
    13Expression that.categoryLabelPositionOffset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression that.strokeIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Unmatched return false;
    16Unmatched return false;
    17Unmatched return false;
    18Unmatched return false;
    19Expression equalPaintMaps(this.tickLabelPaintMap,that.tickLabelPaintMap) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression Arrays.equals(this.outlineStrokeSequence,that.outlineStrokeSequence) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Not all possible execution flows end in a return statement
    22The refactoring of the clones is infeasible, because classes org.jfree.chart.axis.CategoryAxis and org.jfree.chart.plot.DefaultDrawingSupplier do not have a common superclass