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: 21 | Number of AST nodes: 21 | |||
1 | double y = 0.0;↵ | 1 | double x = 0.0;↵ | |
2 | double height = 0.0;↵ | 2 | double width = 0.0;↵ | |
3 | double maxWidth = 0.0;↵ | 3 | double maxHeight = 0.0;↵ | |
4 | List blocks = container.getBlocks();↵ | 4 | List blocks = container.getBlocks();↵ | |
5 | int blockCount = blocks.size();↵ | 5 | int blockCount = blocks.size();↵ | |
6 | if (blockCount > 0) {↵ | 6 | if (blockCount > 0) {↵ | |
7 | Size2D[] sizes = new Size2D[blocks.size()];↵ | 7 | Size2D[] sizes = new Size2D[blocks.size()];↵ | |
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 | width = width + sizes[i].getWidth();↵ | |
12 | maxWidth = Math.max(sizes[i].width, maxWidth);↵ | 12 | maxHeight = Math.max(sizes[i].height, maxHeight);↵ | |
13 | block.setBounds(↵ | 13 | block.setBounds(↵ | |
14 | new Rectangle2D.Double(↵ | 14 | new Rectangle2D.Double(↵ | |
15 | 0.0, y, sizes[i].width, sizes[i].height↵ | 15 | x, 0.0, sizes[i].width, sizes[i].height↵ | |
16 | )↵ | 16 | )↵ | |
17 | );↵ | 17 | );↵ | |
18 | y = y + sizes[i].height + this.verticalGap;↵ | 18 | x = x + sizes[i].width + this.horizontalGap;↵ | |
19 | }↵ | 19 | }↵ | |
20 | if (blockCount > 1) {↵ | 20 | if (blockCount > 1) {↵ | |
21 | height = height + this.verticalGap * (blockCount - 1); ↵ | 21 | width = width + this.horizontalGap * (blockCount - 1); ↵ | |
22 | }↵ | 22 | }↵ | |
23 | if (this.horizontalAlignment != HorizontalAlignment.LEFT) {↵ | 23 | if (this.verticalAlignment != VerticalAlignment.TOP) {↵ | |
24 | for (int i = 0; i < blocks.size(); i++) {↵ | 24 | for (int i = 0; i < blocks.size(); i++) {↵ | |
25 | //Block b = (Block) blocks.get(i);↵ | 25 | //Block b = (Block) blocks.get(i);↵ | |
26 | if (this.horizontalAlignment ↵ | 26 | if (this.verticalAlignment ↵ | |
27 | == HorizontalAlignment.CENTER) {↵ | 27 | == VerticalAlignment.CENTER) {↵ | |
28 | //TODO: shift block right by half↵ | 28 | //TODO: shift block down by half↵ | |
29 | }↵ | 29 | }↵ | |
30 | else if (this.horizontalAlignment ↵ | 30 | else if (this.verticalAlignment ↵ | |
31 | == HorizontalAlignment.RIGHT) {↵ | 31 | == VerticalAlignment.BOTTOM) {↵ | |
32 | //TODO: shift block over to right↵ | 32 | //TODO: shift block down to bottom↵ | |
33 | }↵ | 33 | }↵ | |
34 | } ↵ | 34 | } ↵ | |
35 | }↵ | 35 | }↵ | |
36 | }↵ | 36 | }↵ | |
37 | return new Size2D(maxWidth, height); | 37 | return new Size2D(width, maxHeight); | |
See real code fragment | See real code fragment |
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) | 1.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 101 |
Number of mapped statements | 21 |
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) | 27.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | double y = 0.0; |
| 1 | double x = 0.0; | |||||||||||||||||||||||||
2 | double height = 0.0; |
| 3 | double maxHeight = 0.0; | |||||||||||||||||||||||||
3 | double maxWidth = 0.0; |
| 2 | double width = 0.0; | |||||||||||||||||||||||||
4 | List blocks = container.getBlocks(); | 4 | List blocks = container.getBlocks(); | ||||||||||||||||||||||||||
5 | int blockCount = blocks.size(); | 5 | int blockCount = blocks.size(); | ||||||||||||||||||||||||||
6 | if (blockCount > 0) | 6 | if (blockCount > 0) | ||||||||||||||||||||||||||
7 | Size2D[] sizes = new Size2D[blocks.size()]; | 7 | Size2D[] sizes = new Size2D[blocks.size()]; | ||||||||||||||||||||||||||
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 | width = width + sizes[i].getWidth(); | |||||||||||||||||||||||||
12 | maxWidth = Math.max(sizes[i].width, maxWidth); |
| 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(x, 0.0, sizes[i].width, sizes[i].height)); | |||||||||||||||||||||||||
14 | y = y + sizes[i].height + this.verticalGap; |
| 14 | x = x + sizes[i].width + this.horizontalGap; | |||||||||||||||||||||||||
15 | if (blockCount > 1) | 15 | if (blockCount > 1) | ||||||||||||||||||||||||||
16 | height = height + this.verticalGap * (blockCount - 1); |
| 16 | width = width + this.horizontalGap * (blockCount - 1); | |||||||||||||||||||||||||
17 | if (this.horizontalAlignment != HorizontalAlignment.LEFT) |
| 17 | if (this.verticalAlignment != VerticalAlignment.TOP) | |||||||||||||||||||||||||
18 | for (int i = 0; i < blocks.size(); i++) | 18 | for (int i = 0; i < blocks.size(); i++) | ||||||||||||||||||||||||||
19 | if (this.horizontalAlignment == HorizontalAlignment.CENTER) |
| 19 | if (this.verticalAlignment == VerticalAlignment.CENTER) | |||||||||||||||||||||||||
20 | else if (this.horizontalAlignment == HorizontalAlignment.RIGHT) |
| 20 | else if (this.verticalAlignment == VerticalAlignment.BOTTOM) | |||||||||||||||||||||||||
21 | return new Size2D(maxWidth, height); |
| 21 | return new Size2D(width, maxHeight); |
Row | Violation |
---|---|
1 | Expression height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression sizes[i].getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression sizes[i].getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression maxWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression maxHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression maxWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression maxHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression sizes[i].height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
16 | Expression sizes[i].width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Type org.jfree.ui.HorizontalAlignment of variable this.horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable this.verticalAlignment |
22 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
23 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.LEFT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.TOP |
24 | Type org.jfree.ui.HorizontalAlignment of variable this.horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable this.verticalAlignment |
25 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
26 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER |
27 | Type org.jfree.ui.HorizontalAlignment of variable this.horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable this.verticalAlignment |
28 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
29 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.RIGHT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.BOTTOM |
30 | Expression maxWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted |
31 | Expression width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
32 | Expression height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
33 | Expression maxHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted |