for (int i = 0; i < blocks.size(); i++) { 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; }
for (int i = 0; i < blocks.size(); i++) { 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: 7 Number of AST nodes: 7
1
for (int i = 0; i < blocks.size(); i++) {
1
for (int i = 0; i < blocks.size(); i++) {
2
                Block block = (Block) blocks.get(i);
2
                Block block = (Block) blocks.get(i);
3
                sizes[i] = block.arrange(g2, RectangleConstraint.NONE);
3
                sizes[i] = block.arrange(g2, RectangleConstraint.NONE);
4
                height = height + sizes[i].getHeight();
4
                width = width + sizes[i].getWidth();
5
                maxWidth = Math.max(sizes[i].width, maxWidth);
5
                maxHeight = Math.max(sizes[i].height, maxHeight);
6
                block.setBounds(
6
                block.setBounds(
7
                    new Rectangle2D.Double(
7
                    new Rectangle2D.Double(
8
                        0.0, y, sizes[i].width, sizes[i].height
8
                        x, 0.0, sizes[i].width, sizes[i].height
9
                    )
9
                    )
10
                );
10
                );
11
                y = y + sizes[i].height + this.verticalGap;
11
                x = x + sizes[i].width + this.horizontalGap;
12
            }
12
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons50
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)17.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    for (int i = 0; i < blocks.size(); i++)
    8
    for (int i = 0; i < blocks.size(); i++)
    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
    Expression1Expression2Difference
    heightwidthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    getHeightgetWidthMETHOD_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);
    12
    maxHeight = Math.max(sizes[i].height, maxHeight);
    Differences
    Expression1Expression2Difference
    maxWidthmaxHeightVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    maxWidthmaxHeightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    maxHeight = Math.max(sizes[i].height, maxHeight);
    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
    Expression1Expression2Difference
    0.0xTYPE_COMPATIBLE_REPLACEMENT
    y0.0TYPE_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;
    14
    x = x + sizes[i].width + this.horizontalGap;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    verticalGaphorizontalGapVARIABLE_NAME_MISMATCH
    yxVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    x = x + sizes[i].width + this.horizontalGap;
    Precondition Violations (9)
    Row Violation
    1Expression sizes[i].getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression sizes[i].getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Clone fragment #1 returns variables height, maxWidth , while Clone fragment #2 returns variables width, maxHeight