23-1-4

if (obj == this) { return true; } if (!(obj instanceof RelativeDateFormat)) { return false; } if (!super.equals(obj)) { return false; } RelativeDateFormat that = (RelativeDateFormat) obj; if (this.baseMillis != that.baseMillis) { return false; } if (this.showZeroDays != that.showZeroDays) { return false; } if (this.showZeroHours != that.showZeroHours) { return false; } if (!this.positivePrefix.equals(that.positivePrefix)) { return false; } if (!this.daySuffix.equals(that.daySuffix)) { return false; } if (!this.hourSuffix.equals(that.hourSuffix)) { return false; } if (!this.minuteSuffix.equals(that.minuteSuffix)) { return false; } if (!this.secondSuffix.equals(that.secondSuffix)) { return false; } if (!this.secondFormatter.equals(that.secondFormatter)) { return false; } return true;
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;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/util/RelativeDateFormat.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.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 RelativeDateFormat)) {↵

4

            if (!(obj instanceof BarRenderer)) {↵

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

            RelativeDateFormat that = (RelativeDateFormat) obj;↵

10

            BarRenderer that = (BarRenderer) obj;↵

11

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

11

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

12

                return false;↵

12

                return false;↵

13

            }↵

13

            }↵

14

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

14

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

15

                return false;↵

15

                return false;↵

16

            }↵

16

            }↵

17

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

17

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

18

                return false;↵

18

                return false;↵

19

            }↵

19

            }↵

20

            if (!this.positivePrefix.equals(that.positivePrefix)) {↵

20

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

21

                return false;↵

21

                return false;↵

22

            }↵

22

            }↵

23

            if (!this.daySuffix.equals(that.daySuffix)) {↵

23

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

24

                return false;↵

24

                return false;↵

25

            }↵

25

            }↵

26

            if (!this.hourSuffix.equals(that.hourSuffix)) {↵

26

            if (!ObjectUtilities.equal(th↵

27

                return false;↵

27

    is.gradientPaintTransformer,↵

28

            }↵

28

            ↵

29

            if (!this.minuteSuffix.equals(that.minuteSuffix)) {↵

29

            that.gradientPaintTransformer)) {↵

30

                return false;↵

30

                return false;↵

31

            }↵

31

            }↵

32

            if (!this.secondSuffix.equals(that.secondSuffix↵

32

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

33

    )) {↵

33

                that.positiveItemLabelPositionFallback)) {↵

34

                return false;↵

34

                return false;↵

35

            }↵

35

            }↵

36

            if (!this.secondFormatter.equals(that.secondFormatter↵

36

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

37

    )) {↵

37

                that.negativeItemLabelPositionFallback)) {↵

38

                return false;↵

38

                return false;↵

39

            }↵

39

            }↵

40

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 5
   Time elapsed for statement mapping (ms) | 1.9
   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 RelativeDateFormat))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.util.RelativeDateFormat | org.jfree.chart.renderer.category.BarRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof RelativeDateFormat does not match with type boolean of variable obj instanceof BarRenderer
   - Make classes org.jfree.chart.util.RelativeDateFormat and org.jfree.chart.renderer.category.BarRenderer extend a common superclass

   3

       if (!(obj instanceof BarRenderer))

   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

       RelativeDateFormat that = (RelativeDateFormat)obj;

   8

       if (this.base != that.base)

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   8

       if (this.baseMillis != that.baseMillis)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.itemMargin != that.itemMargin)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   10

       if (this.showZeroDays != that.showZeroDays)

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   showZeroDays | drawBarOutline | VARIABLE_NAME_MISMATCH
   org.jfree.chart.util.RelativeDateFormat | org.jfree.chart.renderer.category.BarRenderer | VARIABLE_TYPE_MISMATCH
   showZeroDays | drawBarOutline | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.chart.util.RelativeDateFormat of variable that does not match with type org.jfree.chart.renderer.category.BarRenderer of variable that
   - Make classes org.jfree.chart.util.RelativeDateFormat and org.jfree.chart.renderer.category.BarRenderer extend a common superclass

   12

       if (this.drawBarOutline != that.drawBarOutline)

   11

       return false;

   11 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   Precondition Violations (13)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof RelativeDateFormat does not match with type boolean of variable obj instanceof BarRenderer
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.util.RelativeDateFormat of variable that does not match with type org.jfree.chart.renderer.category.BarRenderer of variable that
   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;