if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYPolygonAnnotation)) { return false; } XYPolygonAnnotation that = (XYPolygonAnnotation) obj; if (!Arrays.equals(this.polygon, that.polygon)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
if (obj == this) { return true; } if (!(obj instanceof MultiplePiePlot)) { return false; } MultiplePiePlot that = (MultiplePiePlot) obj; if (this.dataExtractOrder != that.dataExtractOrder) { return false; } if (this.limit != that.limit) { return false; } if (!this.aggregatedItemsKey.equals(that.aggregatedItemsKey)) { return false; } if (!PaintUtilities.equal(this.aggregatedItemsPaint, that.aggregatedItemsPaint)) { return false; } if (!ObjectUtilities.equal(this.pieChart, that.pieChart)) { return false; } if (!super.equals(obj)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYPolygonAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/MultiplePiePlot.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 18
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality
4
        
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYPolygonAnnotation)) {
9
            return false;
10
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)
5
if (!(obj instanceof MultiplePiePlot)) {
6
            return false;
7
        }
8
        MultiplePiePlot that = (MultiplePiePlot) obj;
9
        if (this.dataExtractOrder != that.dataExtractOrder) {
10
            return false;
11
        }
13
) {
12
        if (this.limit != that.limit) {
14
            return false;   
13
            return false;
15
        }
14
        }
16
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
15
        if (!this.aggregatedItemsKey.equals(that.aggregatedItemsKey)) {
17
            return false;
16
            return false;
18
        }
17
        }
19
        if (!PaintUtilities.equal(this.outlinePaint, that.outline
18
        if (!PaintUtilities.equal(this.aggregatedItemsPaint,
20
Paint)) {
19
                that.aggregatedItemsPaint)) {
21
            return false;
20
            return false;
22
        }
21
        }
23
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
22
        if (!ObjectUtilities.equal(this.pieChart, that.pieChart)) {
24
            return false;
23
            return false;
25
        }
24
        }
26
        // seem to be the same
25
        if (!super.equals(obj)) {
26
            return false;
27
        }
27
        return true;
28
        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)5.3
Clones locationClones are in different classes
Number of node comparisons99
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
                                                                                                              
    6
    if (this.dataExtractOrder != that.dataExtractOrder)
    Preondition Violations
    Unmatched statement if(this.dataExtractOrder != that.dataExtractOrder) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    if (this.dataExtractOrder != that.dataExtractOrder)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
                                                                  
    8
    if (this.limit != that.limit)
    Preondition Violations
    Unmatched statement if(this.limit != that.limit) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    if (this.limit != that.limit)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    16
    if (!super.equals(obj))
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    Super method call if(!super.equals(obj)) cannot be extracted from method
    16
    if (!super.equals(obj))
    4
    return false;
    17
    return false;
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    3
    if (!(obj instanceof MultiplePiePlot))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof MultiplePiePlot))
    6
    return false;
    4
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    5
    MultiplePiePlot that = (MultiplePiePlot)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    5
    MultiplePiePlot that = (MultiplePiePlot)obj;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    10
    if (!this.aggregatedItemsKey.equals(that.aggregatedItemsKey))
    Differences
    Expression1Expression2Difference
    Arrays.equals(this.polygon,that.polygon)this.aggregatedItemsKey.equals(that.aggregatedItemsKey)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression Arrays.equals(this.polygon,that.polygon) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.aggregatedItemsKey.equals(that.aggregatedItemsKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.aggregatedItemsKey.equals(that.aggregatedItemsKey))
    9
    return false;
    11
    return false;
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    14
    if (!ObjectUtilities.equal(this.pieChart, that.pieChart))
    Differences
    Expression1Expression2Difference
    strokepieChartVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.JFreeChartVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    strokepieChartVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.JFreeChartVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.JFreeChart of variable this.pieChart
    • Make classes java.awt.Stroke and org.jfree.chart.JFreeChart extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.pieChart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.JFreeChart of variable that.pieChart
    • Make classes java.awt.Stroke and org.jfree.chart.JFreeChart extend a common superclass
    14
    if (!ObjectUtilities.equal(this.pieChart, that.pieChart))
    11
    return false;
    15
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.aggregatedItemsPaint, that.aggregatedItemsPaint))
    Differences
    Expression1Expression2Difference
    outlinePaintaggregatedItemsPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.plot.MultiplePiePlotSUBCLASS_TYPE_MISMATCH
    outlinePaintaggregatedItemsPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.aggregatedItemsPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (!PaintUtilities.equal(this.aggregatedItemsPaint, that.aggregatedItemsPaint))
    13
    return false;
    13
    return false;
    Precondition Violations (17)
    Row Violation
    1Unmatched statement if(this.dataExtractOrder != that.dataExtractOrder) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return false;
    3Unmatched statement if(this.limit != that.limit) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Super method call if(!super.equals(obj)) cannot be extracted from method
    6Super method call if(!super.equals(obj)) cannot be extracted from method
    7Expression Arrays.equals(this.polygon,that.polygon) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression this.aggregatedItemsKey.equals(that.aggregatedItemsKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.JFreeChart of variable this.pieChart
    10Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.pieChart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.JFreeChart of variable that.pieChart
    13Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression that.aggregatedItemsPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Clone fragment #1 returns variable that with type org.jfree.chart.annotations.XYPolygonAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.plot.MultiplePiePlot
    16Not all possible execution flows end in a return statement
    17The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYPolygonAnnotation and org.jfree.chart.plot.MultiplePiePlot do not have a common superclass