1595-1-2

if (this.centerBlock != null) { RectangleConstraint c4 = new RectangleConstraint(width - w[2] - w[3], null, LengthConstraintType.FIXED, 0.0, null, LengthConstraintType.NONE); Size2D size = this.centerBlock.arrange(g2, c4); w[4] = size.width; h[4] = size.height; }
if (this.bottomBlock != null) { RectangleConstraint c2 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight() - h[0]), LengthConstraintType.RANGE); Size2D size = this.bottomBlock.arrange(g2, c2); h[1] = size.height; }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/BorderArrangement.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/block/BorderArrangement.java
Method name: `Size2D arrangeFN(BlockContainer, Graphics2D, double)` |  | Method name: `Size2D arrangeFF(BlockContainer, Graphics2D, RectangleConstraint)`
Number of AST nodes: 5 |  | Number of AST nodes: 4

1

    if (this.centerBlock != null) {↵

1

    if (this.bottomBlock != null) {↵

2

                RectangleConstraint c4 = new RectangleConstraint(width - w[2]↵

2

                RectangleConstraint c2 = new RectangleConstraint(w[0], null,↵

3

                        - w[3], null, LengthConstraintType.FIXED, 0.0, null,↵

3

                        LengthConstraintType.FIXED, 0.0, new Range(0.0,↵

4

                        LengthConstraintType.NONE);↵

4

                        constraint.getHeight() - h[0]), LengthConstraintType.RANGE);↵

5

                Size2D size = this.centerBlock.arrange(g2, c4);↵

5

                Size2D size = this.bottomBlock.arrange(g2, c2);↵

6

                w[4] = size.width;↵

7

                h[4] = size.height;↵

6

                h[1] = size.height;↵

8

            }

7

            }

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) | 0.1
Clones location | Clones are declared in the same class
Number of node comparisons | 20

1. {Non-refactorable}

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

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

   25

       if (this.centerBlock != null)

   25 | if (this.centerBlock != null)
   9 | if (this.bottomBlock != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   centerBlock | bottomBlock | VARIABLE_NAME_MISMATCH

   9

       if (this.bottomBlock != null)

   26

       RectangleConstraint c4 = new RectangleConstraint(width - w[2] - w[3], null, LengthConstraintType.FIXED, 0.0, null, LengthConstraintType.NONE);

   26 | RectangleConstraint c4 = new RectangleConstraint(width - w[2] - w[3], null, LengthConstraintType.FIXED, 0.0, null, LengthConstraintType.NONE);
   10 | RectangleConstraint c2 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight() - h[0]), LengthConstraintType.RANGE);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   c4 | c2 | VARIABLE_NAME_MISMATCH
   width - w[2] - w[3] | w[0] | TYPE_COMPATIBLE_REPLACEMENT
   null | new Range(0.0,constraint.getHeight() - h[0]) | TYPE_COMPATIBLE_REPLACEMENT
   NONE | RANGE | VARIABLE_NAME_MISMATCH

   10

       RectangleConstraint c2 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight() - h[0]), LengthConstraintType.RANGE);

   27

       Size2D size = this.centerBlock.arrange(g2, c4);

   27 | Size2D size = this.centerBlock.arrange(g2, c4);
   11 | Size2D size = this.bottomBlock.arrange(g2, c2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   c4 | c2 | VARIABLE_NAME_MISMATCH
   centerBlock | bottomBlock | VARIABLE_NAME_MISMATCH

   11

       Size2D size = this.bottomBlock.arrange(g2, c2);

   28

       w[4] = size.width;

   28 | w[4] = size.width;

   Preondition Violations
   Unmatched statement w[4]=size.width; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   29

       h[4] = size.height;

   29 | h[4] = size.height;
   12 | h[1] = size.height;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   4 | 1 | LITERAL_VALUE_MISMATCH

   12

       h[1] = size.height;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Unmatched statement w[4]=size.width; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Clone fragment #1 returns variables size, h , while Clone fragment #2 returns variables h