1011-1-2

if (result == null) { result = new Rectangle2D.Double(); } result.setRect( area.getX() + this.left, area.getY() + this.top, area.getWidth() - this.left - this.right, area.getHeight() - this.top - this.bottom ); return result;
if (result == null) { result = new Rectangle2D.Double(); } result.setRect( area.getX() - this.left, area.getY() - this.top, area.getWidth() + this.left + this.right, area.getHeight() + this.top + this.bottom ); return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/AxisSpace.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/AxisSpace.java
Method name: `Rectangle2D shrink(Rectangle2D, Rectangle2D)` |  | Method name: `Rectangle2D expand(Rectangle2D, Rectangle2D)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    if (result == null) {↵

1

    if (result == null) {↵

2

                result = new Rectangle2D.Double();↵

2

                result = new Rectangle2D.Double();↵

3

            }↵

3

            }↵

4

            result.setRect(↵

4

            result.setRect(↵

5

                area.getX() + this.left, ↵

5

                area.getX() - this.left, ↵

6

                area.getY() + this.top,↵

6

                area.getY() - this.top,↵

7

                area.getWidth() - this.left - this.right,↵

7

                area.getWidth() + this.left + this.right,↵

8

                area.getHeight() - this.top - this.bottom↵

8

                area.getHeight() + this.top + this.bottom↵

9

            );↵

9

            );↵

10

            return result;

10

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are declared in the same class
Number of node comparisons | 8

1. {Refactorable}

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

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

   1

       if (result == null)

   1

       if (result == null)

   2

       result = new Rectangle2D.Double();

   2

       result = new Rectangle2D.Double();

   3

       result.setRect(area.getX() - this.left, area.getY() - this.top, area.getWidth() + this.left + this.right, area.getHeight() + this.top + this.bottom);

   3

       result.setRect(area.getX() + this.left, area.getY() + this.top, area.getWidth() - this.left - this.right, area.getHeight() - this.top - this.bottom);

   4

       return result;

   4

       return result;

   Precondition Violations (0)
   Row | Violation
   --- | ---