129-1-2

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;

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) | 7.5
Clones location | Clones are in different classes
Number of node comparisons | 175

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 9
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 1.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 CategoryAxis))

   3 | if (!(obj instanceof CategoryAxis))
   3 | if (!(obj instanceof DefaultDrawingSupplier))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.CategoryAxis | org.jfree.chart.plot.DefaultDrawingSupplier | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof CategoryAxis does not match with type boolean of variable obj instanceof 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;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       DefaultDrawingSupplier that = (DefaultDrawingSupplier)obj;

   5

       if (!super.equals(obj))

   5 | if (! super.equals(obj))
   6 | if (! Arrays.equals(this.paintSequence, that.paintSequence))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   super.equals(obj) | Arrays.equals(this.paintSequence,that.paintSequence) | TYPE_COMPATIBLE_REPLACEMENT

   6

       if (!Arrays.equals(this.paintSequence, that.paintSequence))

   6

       return false;

   6 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional 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 (that.upperMargin != this.upperMargin)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched 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)
   8 | if (this.paintIndex != that.paintIndex)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   that.categoryLabelPositionOffset | this.paintIndex | TYPE_COMPATIBLE_REPLACEMENT
   this.categoryLabelPositionOffset | that.paintIndex | TYPE_COMPATIBLE_REPLACEMENT

   8

       if (this.paintIndex != that.paintIndex)

   17

       return false;

   17 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (13)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof CategoryAxis does not match with type boolean of variable obj instanceof DefaultDrawingSupplier
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Conditional return true;
   7 | Conditional return true;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;