for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); Size2D size = block.arrange(g2, RectangleConstraint.NONE); if (y + size.height <= height) { itemsInColumn.add(block); block.setBounds( new Rectangle2D.Double(x, y, size.width, size.height) ); y = y + size.height + this.verticalGap; maxWidth = Math.max(maxWidth, size.width); } else { 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);
for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); Size2D size = block.arrange(g2, RectangleConstraint.NONE); if (x + size.width <= width) { itemsInRow.add(block); block.setBounds( new Rectangle2D.Double(x, y, size.width, size.height) ); x = x + size.width + this.horizontalGap; maxHeight = Math.max(maxHeight, size.height); } else { 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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
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
            Size2D size = block.arrange(g2, RectangleConstraint.NONE);
3
            Size2D size = block.arrange(g2, RectangleConstraint.NONE);
4
            if (y + size.height <= height) {
4
            if (x + size.width <= width) {
5
                itemsInColumn.add(block);
5
                itemsInRow.add(block);
6
                block.setBounds(
6
                block.setBounds(
7
                    new Rectangle2D.Double(x, y, size.width, size.height)
7
                    new Rectangle2D.Double(x, y, size.width, size.height)
8
                );
8
                );
9
                y = y + size.height + this.verticalGap;
9
                x = x + size.width + this.horizontalGap;
10
                maxWidth = Math.max(maxWidth, size.width);
10
                maxHeight = Math.max(maxHeight, size.height);
11
            }
11
            }
12
            else {
12
            else {
13
                if (itemsInColumn.isEmpty()) {
13
                if (itemsInRow.isEmpty()) {
14
                    // place in this column (truncated) anyway
14
                    // place in this row (truncated) anyway
15
                    block.setBounds(
15
                    block.setBounds(
16
                        new Rectangle2D.Double(
16
                        new Rectangle2D.Double(
17
                            x, y, size.width, Math.min(size.height, height - y)
17
                            x, y, Math.min(size.width, width - x), size.height
18
                        )
18
                        )
19
                    );
19
                    );
20
                    y = 0.0;
20
                    x = 0.0;
21
                    x = x + size.width + this.horizontalGap;
21
                    y = y + size.height + this.verticalGap;
22
                }
22
                }
23
                else {
23
                else {
24
                    // start new column
24
                    // start new row
25
                    itemsInColumn.clear();
25
                    itemsInRow.clear();
26
                    x = x + maxWidth + this.horizontalGap;
26
                    x = 
27
                    y = 0.0
27
0.0;
28
;
28
                    y = y + maxHeight + this.verticalGap;
29
                    maxWidth = size.width;
29
                    maxHeight = size.height;
30
                    block.setBounds(
30
                    block.setBounds(
31
                        new Rectangle2D.Double(
31
                        new Rectangle2D.Double(
32
                            x, y, size.width, Math.min(size.height, height)
32
                            x, y, Math.min(size.width, width), size.height
33
                        )
33
                        )
34
                    );
34
                    );
35
                    y = size.height + this.verticalGap;
35
                    x = size.width + this.horizontalGap;
36
                    itemsInColumn.add(block);
36
                    itemsInRow.add(block);
37
                
37
                
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0