1199-1-2

Block block = (Block) blocks.get(i); sizes[i] = block.arrange(g2, RectangleConstraint.NONE); height = height + sizes[i].getHeight(); maxWidth = Math.max(sizes[i].width, maxWidth); block.setBounds( new Rectangle2D.Double( 0.0, y, sizes[i].width, sizes[i].height ) ); y = y + sizes[i].height + this.verticalGap;
Block block = (Block) blocks.get(i); sizes[i] = block.arrange(g2, RectangleConstraint.NONE); width = width + sizes[i].getWidth(); maxHeight = Math.max(sizes[i].height, maxHeight); block.setBounds( new Rectangle2D.Double( x, 0.0, sizes[i].width, sizes[i].height ) ); x = x + sizes[i].width + this.horizontalGap;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/ColumnArrangement.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/block/FlowArrangement.java
Method name: `Size2D arrangeNN(BlockContainer, Graphics2D)` |  | Method name: `Size2D arrangeNN(BlockContainer, Graphics2D)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    Block block = (Block) blocks.get(i);↵

1

    Block block = (Block) blocks.get(i);↵

2

                    sizes[i] = block.arrange(g2, RectangleConstraint.NONE);↵

2

                    sizes[i] = block.arrange(g2, RectangleConstraint.NONE);↵

3

                    height = height + sizes[i].getHeight();↵

3

                    width = width + sizes[i].getWidth();↵

4

                    maxWidth = Math.max(sizes[i].width, maxWidth);↵

4

                    maxHeight = Math.max(sizes[i].height, maxHeight);↵

5

                    block.setBounds(↵

5

                    block.setBounds(↵

6

                        new Rectangle2D.Double(↵

6

                        new Rectangle2D.Double(↵

7

                            0.0, y, sizes[i].width, sizes[i].height↵

7

                            x, 0.0, sizes[i].width, sizes[i].height↵

8

                        )↵

8

                        )↵

9

                    );↵

9

                    );↵

10

                    y = y + sizes[i].height + this.verticalGap;

10

                    x = x + sizes[i].width + this.horizontalGap;

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.0
Clones location | Clones are in different classes
Number of node comparisons | 21

1. {Non-refactorable}

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

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

   9

       Block block = (Block)blocks.get(i);

   9

       Block block = (Block)blocks.get(i);

   10

       sizes[i] = block.arrange(g2, RectangleConstraint.NONE);

   10

       sizes[i] = block.arrange(g2, RectangleConstraint.NONE);

   11

       height = height + sizes[i].getHeight();

   11 | height = height + sizes[i].getHeight();
   11 | width = width + sizes[i].getWidth();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   height | width | VARIABLE_NAME_MISMATCH
   height | width | VARIABLE_NAME_MISMATCH
   getHeight | getWidth | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression sizes[i].getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression sizes[i].getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   11

       width = width + sizes[i].getWidth();

   12

       maxWidth = Math.max(sizes[i].width, maxWidth);

   12 | maxWidth = Math.max(sizes[i].width, maxWidth);
   14 | x = x + sizes[i].width + this.horizontalGap;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   maxWidth | x | VARIABLE_NAME_MISMATCH
   Math.max(sizes[i].width,maxWidth) | x + sizes[i].width + this.horizontalGap | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression Math.max(sizes[i].width,maxWidth) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression x + sizes[i].width + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted

   14

       x = x + sizes[i].width + this.horizontalGap;

   13

       block.setBounds(new Rectangle2D.Double(0.0, y, sizes[i].width, sizes[i].height));

   13 | block.setBounds(new Rectangle2D.Double(0.0, y, sizes[i].width, sizes[i].height));
   13 | block.setBounds(new Rectangle2D.Double(x, 0.0, sizes[i].width, sizes[i].height));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0.0 | x | TYPE_COMPATIBLE_REPLACEMENT
   y | 0.0 | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted

   13

       block.setBounds(new Rectangle2D.Double(x, 0.0, sizes[i].width, sizes[i].height));

   14

       y = y + sizes[i].height + this.verticalGap;

   14 | y = y + sizes[i].height + this.verticalGap;
   12 | maxHeight = Math.max(sizes[i].height, maxHeight);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   y | maxHeight | VARIABLE_NAME_MISMATCH
   y + sizes[i].height + this.verticalGap | Math.max(sizes[i].height,maxHeight) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression y + sizes[i].height + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression Math.max(sizes[i].height,maxHeight) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   12

       maxHeight = Math.max(sizes[i].height, maxHeight);

   Precondition Violations (9)
   Row | Violation
   --- | ---
   1 | Expression sizes[i].getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression sizes[i].getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression Math.max(sizes[i].width,maxWidth) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression x + sizes[i].width + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression y + sizes[i].height + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression Math.max(sizes[i].height,maxHeight) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Clone fragment #1 returns variables height, maxWidth, y , while Clone fragment #2 returns variables width, maxHeight, x