23-4-7

if (obj == this) { return true; } if (!(obj instanceof BarRenderer)) { return false; } if (!super.equals(obj)) { return false; } BarRenderer that = (BarRenderer) obj; if (this.base != that.base) { return false; } if (this.itemMargin != that.itemMargin) { return false; } if (this.drawBarOutline != that.drawBarOutline) { return false; } if (this.maximumBarWidth != that.maximumBarWidth) { return false; } if (this.minimumBarLength != that.minimumBarLength) { return false; } if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer)) { return false; } if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback)) { return false; } if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof XYBarRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYBarRenderer that = (XYBarRenderer) obj; if (this.base != that.base) { return false; } if (this.drawBarOutline != that.drawBarOutline) { return false; } if (this.margin != that.margin) { return false; } if (this.useYInterval != that.useYInterval) { return false; } if (!ObjectUtilities.equal( this.gradientPaintTransformer, that.gradientPaintTransformer) ) { return false; } if (!ShapeUtilities.equal(this.legendBar, that.legendBar)) { return false; } if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback)) { return false; } if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBarRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 24 |  | 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 BarRenderer)) {↵

4

            if (!(obj instanceof XYBarRenderer)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            if (!super.equals(obj)) {↵

7

            if (!super.equals(obj)) {↵

8

                return false;↵

8

                return false;↵

9

            }↵

9

            }↵

10

            BarRenderer that = (BarRenderer) obj;↵

10

            XYBarRenderer that = (XYBarRenderer) obj;↵

11

            if (this.base != that.base) {↵

11

            if (this.base != that.base) {↵

12

                return false;↵

12

                return false;↵

13

            }↵

13

            }↵

14

            if (this.itemMargin != that.itemMargin) {↵

14

            if (this.drawBarOutline != that.drawBarOutline) {↵

15

                return false;↵

15

                return false;↵

16

            }↵

16

            }↵

17

            if (this.drawBarOutline != that.drawBarOutline) {↵

17

            if (this.margin != that.margin) {↵

18

                return false;↵

18

                return false;↵

19

            }↵

19

            }↵

20

            if (this.maximumBarWidth != that.maximumBarWidth) {↵

20

            if (this.useYInterval != that.useYInterval) {↵

21

                return false;↵

21

                return false;↵

22

            }↵

22

            }↵

23

            if (this.minimumBarLength != that.minimumBarLength↵

23

            if (!ObjectUtilities.equal(↵

24

                this.gradientPaintTransformer, that.gradientPaintTransformer)↵

24

    ) {↵

25

            ) {↵

25

                return false;↵

26

                return false;↵

26

            }↵

27

            }↵

27

            if (!ObjectUtilities.equal(this.gradientPaintTransformer,↵

28

            if (!ShapeUtilities.equal(this.↵

28

                    that.gradientPaintTransformer)) {↵

29

    legendBar, that.legendBar)) {↵

29

                return false;↵

30

                return false;   ↵

30

            }↵

31

            }↵

31

            if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,↵

32

            if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,↵

32

                that.positiveItemLabelPositionFallback)) {↵

33

                    that.positiveItemLabelPositionFallback)) {↵

33

                return false;↵

34

                return false;↵

34

            }↵

35

            }↵

35

            if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,↵

36

            if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,↵

36

                that.negativeItemLabelPositionFallback)) {↵

37

                    that.negativeItemLabelPositionFallback)) {↵

37

                return false;↵

38

                return false;↵

38

            }↵

39

            }        ↵

39

            return true;

40

            return true;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 14.6
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 257

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 19
   Number of unmapped statements in the first code fragment | 4
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 6.6
   Clone type | Type 3

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (obj == this)

   1

       if (obj == this)

   2

       return true;

   2 | return true;
   2 | return true;

   Preondition Violations
   Conditional return true;
   Conditional return true;

   2

       return true;

   3

       if (!(obj instanceof BarRenderer))

   3 | if (!(obj instanceof BarRenderer))
   3 | if (!(obj instanceof XYBarRenderer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   3

       if (!(obj instanceof XYBarRenderer))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       if (!super.equals(obj))

   5

       if (!super.equals(obj))

   6

       return false;

   6 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   7

       BarRenderer that = (BarRenderer)obj;

   7 | BarRenderer that = (BarRenderer)obj;
   7 | XYBarRenderer that = (XYBarRenderer)obj;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   7

       XYBarRenderer that = (XYBarRenderer)obj;

   8

       if (this.base != that.base)

   8 | if (this.base != that.base)
   8 | if (this.base != that.base)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   8

       if (this.base != that.base)

   9

       return false;

   9 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   10

       if (this.itemMargin != that.itemMargin)

   10 | if (this.itemMargin != that.itemMargin)
   12 | if (this.margin != that.margin)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   itemMargin | margin | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH
   itemMargin | margin | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression that.itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression that.margin cannot be parameterized, because it has dependencies to/from statements that will be extracted

   12

       if (this.margin != that.margin)

   11

       return false;

   11 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   12

       if (this.drawBarOutline != that.drawBarOutline)

   12 | if (this.drawBarOutline != that.drawBarOutline)
   10 | if (this.drawBarOutline != that.drawBarOutline)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   10

       if (this.drawBarOutline != that.drawBarOutline)

   13

       return false;

   13 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   14

       if (this.useYInterval != that.useYInterval)

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   14

       if (this.maximumBarWidth != that.maximumBarWidth)

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       if (this.minimumBarLength != that.minimumBarLength)

   17

       return false;

   17 | return false;

   Preondition Violations
   Unmatched return false;

   18

       if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))

   18 | if (! ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))
   16 | if (! ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   16

       if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))

   19

       return false;

   19 | return false;
   17 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   17

       return false;

   20

       if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))

   20 | if (! ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))
   20 | if (! ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.BarRenderer | org.jfree.chart.renderer.xy.XYBarRenderer | SUBCLASS_TYPE_MISMATCH

   20

       if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))

   21

       return false;

   21 | return false;
   21 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   21

       return false;

   22

       if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))

   22 | if (! ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))
   18 | if (! ShapeUtilities.equal(this.legendBar, that.legendBar))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   negativeItemLabelPositionFallback | legendBar | VARIABLE_NAME_MISMATCH
   org.jfree.chart.labels.ItemLabelPosition | java.awt.Shape | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.ShapeUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.labels.ItemLabelPosition of variable this.negativeItemLabelPositionFallback does not match with type java.awt.Shape of variable this.legendBar
   - Make classes org.jfree.chart.labels.ItemLabelPosition and java.awt.Shape extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.ShapeUtilities of variable ShapeUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.ShapeUtilities extend a common superclass

   18

       if (!ShapeUtilities.equal(this.legendBar, that.legendBar))

   23

       return false;

   23 | return false;
   19 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   19

       return false;

   Precondition Violations (26)
   Row | Violation
   --- | ---
   1 | Expression that.itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression that.margin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Type org.jfree.chart.labels.ItemLabelPosition of variable this.negativeItemLabelPositionFallback does not match with type java.awt.Shape of variable this.legendBar
   7 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.ShapeUtilities of variable ShapeUtilities
   8 | Clone fragment #1 returns variable that with type org.jfree.chart.renderer.category.BarRenderer , while Clone fragment #2 returns variable that with type org.jfree.chart.renderer.xy.XYBarRenderer
   9 | Conditional return true;
   10 | Conditional return true;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;
   14 | Conditional return false;
   15 | Conditional return false;
   16 | Conditional return false;
   17 | Conditional return false;
   18 | Conditional return false;
   19 | Conditional return false;
   20 | Conditional return false;
   21 | Conditional return false;
   22 | Conditional return false;
   23 | Conditional return false;
   24 | Conditional return false;
   25 | Conditional return false;
   26 | Conditional return false;