if (itemsInColumn.isEmpty()) { // place in this column (truncated) anyway block.setBounds( new Rectangle2D.Double( x, y, size.width, Math.min(size.height, height - y) ) ); y = 0.0; x = x + size.width + this.horizontalGap; } else { // start new column itemsInColumn.clear(); x = x + maxWidth + this.horizontalGap; y = 0.0; maxWidth = size.width; block.setBounds( new Rectangle2D.Double( x, y, size.width, Math.min(size.height, height) ) ); y = size.height + this.verticalGap; itemsInColumn.add(block); }
if (itemsInRow.isEmpty()) { // place in this row (truncated) anyway block.setBounds( new Rectangle2D.Double( x, y, Math.min(size.width, width - x), size.height ) ); x = 0.0; y = y + size.height + this.verticalGap; } else { // start new row itemsInRow.clear(); x = 0.0; y = y + maxHeight + this.verticalGap; maxHeight = size.height; block.setBounds( new Rectangle2D.Double( x, y, Math.min(size.width, width), size.height ) ); x = size.width + this.horizontalGap; itemsInRow.add(block); }
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 arrangeNF(BlockContainer, Graphics2D, RectangleConstraint) Method name: Size2D arrangeFN(BlockContainer, Graphics2D, RectangleConstraint)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (itemsInColumn.isEmpty()) {
1
if (itemsInRow.isEmpty()) {
2
                    // place in this column (truncated) anyway
2
                    // place in this row (truncated) anyway
3
                    block.setBounds(
3
                    block.setBounds(
4
                        new Rectangle2D.Double(
4
                        new Rectangle2D.Double(
5
                            x, y, size.width, Math.min(size.height, height - y)
5
                            x, y, Math.min(size.width, width - x), size.height
6
                        )
6
                        )
7
                    );
7
                    );
8
                    y = 0.0;
8
                    x = 0.0;
9
                    x = x + size.width + this.horizontalGap;
9
                    y = y + size.height + this.verticalGap;
10
                }
10
                }
11
                else {
11
                else {
12
                    // start new column
12
                    // start new row
13
                    itemsInColumn.clear();
13
                    itemsInRow.clear();
14
                    x = x + maxWidth + this.horizontalGap;
14
                    x = 
15
                    y = 0.0
15
0.0;
16
;
16
                    y = y + maxHeight + this.verticalGap;
17
                    maxWidth = size.width;
17
                    maxHeight = size.height;
18
                    block.setBounds(
18
                    block.setBounds(
19
                        new Rectangle2D.Double(
19
                        new Rectangle2D.Double(
20
                            x, y, size.width, Math.min(size.height, height)
20
                            x, y, Math.min(size.width, width), size.height
21
                        )
21
                        )
22
                    );
22
                    );
23
                    y = size.height + this.verticalGap;
23
                    x = size.width + this.horizontalGap;
24
                    itemsInColumn.add(block);
24
                    itemsInRow.add(block);
25
                }
25
                }
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.3
Clones locationClones are in different classes
Number of node comparisons123
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)25.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    if (itemsInColumn.isEmpty())
    17
    if (itemsInColumn.isEmpty())
    15
    if (itemsInRow.isEmpty())
    Differences
    Expression1Expression2Difference
    itemsInColumnitemsInRowVARIABLE_NAME_MISMATCH
    15
    if (itemsInRow.isEmpty())
    18
    block.setBounds(new Rectangle2D.Double(x, y, size.width, Math.min(size.height, height - y)));
    18
    block.setBounds(new Rectangle2D.Double(x, y, size.width, Math.min(size.height, height - y)));
    16
    block.setBounds(new Rectangle2D.Double(x, y, Math.min(size.width, width - x), size.height));
    Differences
    Expression1Expression2Difference
    size.widthMath.min(size.width,width - x)TYPE_COMPATIBLE_REPLACEMENT
    Math.min(size.height,height - y)size.heightTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression Math.min(size.width,width - x) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Math.min(size.height,height - y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    block.setBounds(new Rectangle2D.Double(x, y, Math.min(size.width, width - x), size.height));
    19
    y = 0.0;
    19
    y = 0.0;
    18
    y = y + size.height + this.verticalGap;
    Differences
    Expression1Expression2Difference
    0.0y + size.height + this.verticalGapTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression y + size.height + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    y = y + size.height + this.verticalGap;
    20
    x = x + size.width + this.horizontalGap;
    20
    x = x + size.width + this.horizontalGap;
    17
    x = 0.0;
    Differences
    Expression1Expression2Difference
    x + size.width + this.horizontalGap0.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression x + size.width + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    x = 0.0;
    else
    else
    21
    itemsInColumn.clear();
    21
    itemsInColumn.clear();
    19
    itemsInRow.clear();
    Differences
    Expression1Expression2Difference
    itemsInColumnitemsInRowVARIABLE_NAME_MISMATCH
    19
    itemsInRow.clear();
    22
    x = x + maxWidth + this.horizontalGap;
    22
    x = x + maxWidth + this.horizontalGap;
    20
    x = 0.0;
    Differences
    Expression1Expression2Difference
    x + maxWidth + this.horizontalGap0.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression x + maxWidth + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20
    x = 0.0;
    23
    y = 0.0;
    23
    y = 0.0;
    21
    y = y + maxHeight + this.verticalGap;
    Differences
    Expression1Expression2Difference
    0.0y + maxHeight + this.verticalGapTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression y + maxHeight + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21
    y = y + maxHeight + this.verticalGap;
    24
    maxWidth = size.width;
    24
    maxWidth = size.width;
    24
    x = size.width + this.horizontalGap;
    Differences
    Expression1Expression2Difference
    maxWidthxVARIABLE_NAME_MISMATCH
    size.widthsize.width + this.horizontalGapTYPE_COMPATIBLE_REPLACEMENT
    24
    x = size.width + this.horizontalGap;
    25
    block.setBounds(new Rectangle2D.Double(x, y, size.width, Math.min(size.height, height)));
    25
    block.setBounds(new Rectangle2D.Double(x, y, size.width, Math.min(size.height, height)));
    23
    block.setBounds(new Rectangle2D.Double(x, y, Math.min(size.width, width), size.height));
    Differences
    Expression1Expression2Difference
    size.widthMath.min(size.width,width)TYPE_COMPATIBLE_REPLACEMENT
    Math.min(size.height,height)size.heightTYPE_COMPATIBLE_REPLACEMENT
    23
    block.setBounds(new Rectangle2D.Double(x, y, Math.min(size.width, width), size.height));
    26
    y = size.height + this.verticalGap;
    26
    y = size.height + this.verticalGap;
    22
    maxHeight = size.height;
    Differences
    Expression1Expression2Difference
    ymaxHeightVARIABLE_NAME_MISMATCH
    size.height + this.verticalGapsize.heightTYPE_COMPATIBLE_REPLACEMENT
    22
    maxHeight = size.height;
    27
    itemsInColumn.add(block);
    27
    itemsInColumn.add(block);
    25
    itemsInRow.add(block);
    Differences
    Expression1Expression2Difference
    itemsInColumnitemsInRowVARIABLE_NAME_MISMATCH
    25
    itemsInRow.add(block);
    Precondition Violations (7)
    Row Violation
    1Expression Math.min(size.width,width - x) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression Math.min(size.height,height - y) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression y + size.height + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression x + size.width + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression x + maxWidth + this.horizontalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression y + maxHeight + this.verticalGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables y, x, maxWidth , while Clone fragment #2 returns variables x, y, maxHeight