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 TextTitle)) { return false; } TextTitle that = (TextTitle) obj; if (!ObjectUtilities.equal(this.text, that.text)) { return false; } if (!ObjectUtilities.equal(this.font, that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (this.textAlignment != that.textAlignment) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (this.maximumLinesToDisplay != that.maximumLinesToDisplay) { return false; } if (this.expandToFitSpace != that.expandToFitSpace) { return false; } if (!ObjectUtilities.equal(this.toolTipText, that.toolTipText)) { return false; } if (!ObjectUtilities.equal(this.urlText, that.urlText)) { return false; } return super.equals(obj);
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/title/TextTitle.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 26 Number of AST nodes: 24
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 
5
            return false;
6
        }
7
        if (!super.equals(obj)) {
5
TextTitle)) {
8
            return false;
6
            return false;
9
        }
7
        }
10
        CategoryAxis that = (CategoryAxis) obj;
8
        
11
        if (that.lowerMargin != this.lowerMargin
9
TextTitle that = (TextTitle) obj;
12
) {
10
        if (!ObjectUtilities.equal(this.text, that.text)) {
13
            return false;
11
            return false;
14
        }
12
        }
15
        if (that.upperMargin != this.upperMargin) {
13
        if (!ObjectUtilities.equal(this.font, that.font)) {
16
            return false;
14
            return false;
17
        }
15
        }
18
        if (that.categoryMargin != this.categoryMargin) {
16
        if (!PaintUtilities.equal(this.paint, that.paint)) {
19
            return false;
17
            return false;
20
        }
18
        }
21
        if (that.maximumCategoryLabelWidthRatio
19
        if (th
22
                != this.maximumCategoryLabelWidthRatio) {
20
is.textAlignment != that.textAlignment) {
23
            return false;
21
            return false;
24
        }
22
        }
25
        if (that.categoryLabelPositionOffset
23
        if (
26
                != this.categoryLabelPositionOffset) {
24
!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
27
            return false;
25
            return false;
28
        }
26
        }
29
        if (!ObjectUtilities.equal(that.categoryLabelPositions,
27
        if (
30
                this.categoryLabelPositions)) {
28
this.maximumLinesToDisplay != that.maximumLinesToDisplay) {
31
            return false;
29
            return false;
32
        }
30
        }
33
        if (!ObjectUtilities.equal(that.categoryLabelToolTips,
31
        if (
34
                this.categoryLabelToolTips)) {
32
this.expandToFitSpace != that.expandToFitSpace) {
35
            return false;
33
            return false;
36
        }
34
        }
37
        if (!ObjectUtilities.equal(this.tickLabelFontMap,
35
        if (!ObjectUtilities.equal(this.t
38
                that.tickLabelFontMap)) {
36
oolTipText, that.toolTipText)) {
39
            return false;
37
            return false;
40
        }
38
        }
41
        if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap)) {
39
        if (!ObjectUtilities.equal(this.urlText, that.urlText)) {
42
            return false;
40
            return false;
43
        }
41
        }
44
        return true;
42
        return super.equals(obj);
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)85.7
Clones locationClones are in different classes
Number of node comparisons181
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment13
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)139.0
    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 TextTitle))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.title.TextTitleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.axis.CategoryAxis does not match with type org.jfree.chart.title.TextTitle
    • Make classes org.jfree.chart.axis.CategoryAxis and org.jfree.chart.title.TextTitle extend a common superclass
    3
    if (!(obj instanceof TextTitle))
    4
    return false;
    4
    return false;
                                                                      
    5
    TextTitle that = (TextTitle)obj;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    6
    if (!ObjectUtilities.equal(this.text, that.text))
    Differences
    Expression1Expression2Difference
    super.equals(obj)ObjectUtilities.equal(this.text,that.text)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.text,that.text) 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
    6
    if (!ObjectUtilities.equal(this.text, that.text))
    6
    return false;
    7
    return false;
    7
    CategoryAxis that = (CategoryAxis)obj;
                                                                                  
    8
    if (that.lowerMargin != this.lowerMargin)
                                                                                          
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
                                                                                                            
    10
    if (!PaintUtilities.equal(this.paint, that.paint))
                                      
    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.textAlignment != that.textAlignment)
                                      
    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 (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.maximumLinesToDisplay != that.maximumLinesToDisplay)
    Differences
    Expression1Expression2Difference
    that.categoryLabelPositionOffsetthis.maximumLinesToDisplayTYPE_COMPATIBLE_REPLACEMENT
    this.categoryLabelPositionOffsetthat.maximumLinesToDisplayTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression that.categoryLabelPositionOffset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.maximumLinesToDisplay cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (this.maximumLinesToDisplay != that.maximumLinesToDisplay)
    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 (!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))
    22
    if (!ObjectUtilities.equal(this.tickLabelFontMap, that.tickLabelFontMap))
    8
    if (!ObjectUtilities.equal(this.font, that.font))
    Differences
    Expression1Expression2Difference
    tickLabelFontMapfontVARIABLE_NAME_MISMATCH
    java.util.Mapjava.awt.FontVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.title.TextTitleVARIABLE_TYPE_MISMATCH
    tickLabelFontMapfontVARIABLE_NAME_MISMATCH
    java.util.Mapjava.awt.FontVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map of variable this.tickLabelFontMap does not match with type java.awt.Font of variable this.font
    • Make classes java.util.Map and java.awt.Font extend a common superclass
    Type java.util.Map of variable that.tickLabelFontMap does not match with type java.awt.Font of variable that.font
    • Make classes org.jfree.chart.axis.CategoryAxis and org.jfree.chart.title.TextTitle extend a common superclass
    Expression that.tickLabelFontMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.font cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.Map of variable that.tickLabelFontMap does not match with type java.awt.Font of variable that.font
    • Make classes java.util.Map and java.awt.Font extend a common superclass
    8
    if (!ObjectUtilities.equal(this.font, that.font))
    23
    return false;
    9
    return false;
    24
    if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap))
    24
    if (!equalPaintMaps(this.tickLabelPaintMap, that.tickLabelPaintMap))
    14
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    Differences
    Expression1Expression2Difference
    equalPaintMaps(this.tickLabelPaintMap,that.tickLabelPaintMap)PaintUtilities.equal(this.backgroundPaint,that.backgroundPaint)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 PaintUtilities.equal(this.backgroundPaint,that.backgroundPaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    25
    return false;
    15
    return false;
    Precondition Violations (22)
    Row Violation
    1Type org.jfree.chart.axis.CategoryAxis does not match with type org.jfree.chart.title.TextTitle
    2Expression ObjectUtilities.equal(this.text,that.text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Super method call if(!super.equals(obj)) cannot be extracted from method
    4Unmatched return false;
    5Unmatched return false;
    6Unmatched return false;
    7Unmatched return false;
    8Unmatched return false;
    9Unmatched return false;
    10Expression that.categoryLabelPositionOffset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.maximumLinesToDisplay cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Unmatched return false;
    13Unmatched return false;
    14Type java.util.Map of variable this.tickLabelFontMap does not match with type java.awt.Font of variable this.font
    15Type java.util.Map of variable that.tickLabelFontMap does not match with type java.awt.Font of variable that.font
    16Expression that.tickLabelFontMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression that.font cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type java.util.Map of variable that.tickLabelFontMap does not match with type java.awt.Font of variable that.font
    19Expression equalPaintMaps(this.tickLabelPaintMap,that.tickLabelPaintMap) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression PaintUtilities.equal(this.backgroundPaint,that.backgroundPaint) 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.title.TextTitle do not have a common superclass