File path: /jfreechart-1.0.10/src/org/jfree/chart/title/ImageTitle.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/ImageTitle.java | |||
Method name: Size2D drawHorizontal(Graphics2D, Rectangle2D)
|
Method name: Size2D drawVertical(Graphics2D, Rectangle2D)
|
|||
Number of AST nodes: 25 | Number of AST nodes: 26 | |||
1 | double startY = 0.0;↵ | 1 | double startX = 0.0;↵ | |
2 | double topSpace = 0.0;↵ | 2 | double topSpace = 0.0;↵ | |
3 | double bottomSpace = 0.0;↵ | 3 | double bottomSpace = 0.0;↵ | |
4 | double leftSpace = 0.0;↵ | 4 | double leftSpace = 0.0;↵ | |
5 | double rightSpace = 0.0;↵ | 5 | double rightSpace = 0.0;↵ | |
6 | double w = getWidth();↵ | 6 | double w = getWidth();↵ | |
7 | double h = getHeight();↵ | 7 | double h = getHeight();↵ | |
8 | RectangleInsets padding = getPadding();↵ | 8 | RectangleInsets padding = getPadding();↵ | |
9 | if (padding != null) {↵ | |||
9 | topSpace = padding.calculateTopOutset(h);↵ | 10 | topSpace = padding.calculateTopOutset(h);↵ | |
10 | bottomSpace = padding.calculateBottomOutset(h);↵ | 11 | bottomSpace = padding.calculateBottomOutset(h);↵ | |
11 | leftSpace = padding.calculateLeftOutset(w);↵ | 12 | leftSpace = padding.calculateLeftOutset(w);↵ | |
12 | rightSpace = padding.calculateRightOutset(w); ↵ | 13 | rightSpace = padding.calculateRightOutset(w); ↵ | |
14 | } ↵ | |||
13 | if (getPosition() == RectangleEdge.TOP) {↵ | 15 | if (getPosition() == RectangleEdge.LEFT) {↵ | |
14 | startY = chartArea.getY() + topSpace;↵ | 16 | startX = chartArea.getX() + leftSpace;↵ | |
15 | }↵ | 17 | }↵ | |
16 | else {↵ | 18 | else {↵ | |
17 | startY = chartArea.getY() + chartArea.getHeight() - bottomSpace - h;↵ | 19 | startX = chartArea.getMaxX() - rightSpace - w;↵ | |
18 | }↵ | 20 | }↵ | |
19 | // what is our alignment?↵ | 21 | // what is our alignment?↵ | |
20 | HorizontalAlignment horizontalAlignment = getHorizontalAlignment();↵ | 22 | VerticalAlignment alignment = getVerticalAlignment();↵ | |
21 | double startX = 0.0;↵ | 23 | double startY = 0.0;↵ | |
22 | if (horizontalAlignment == HorizontalAlignment.CENTER) {↵ | 24 | if (alignment == VerticalAlignment.CENTER) {↵ | |
23 | startX = chartArea.getX() + leftSpace↵ | 25 | startY = chartArea.getMinY() + topSpace↵ | |
24 | + chartArea.getWidth() / 2.0↵ | 26 | + chartArea.getHeight() / 2.0↵ | |
25 | - w / 2.0;↵ | 27 | - h / 2.0;↵ | |
26 | }↵ | 28 | }↵ | |
27 | else if (horizontalAlignment == HorizontalAlignment.LEFT) {↵ | 29 | else if (alignment == VerticalAlignment.TOP) {↵ | |
28 | startX = chartArea.getX() + leftSpace;↵ | 30 | startY = chartArea.getMinY() + topSpace;↵ | |
29 | }↵ | 31 | }↵ | |
30 | else if (horizontalAlignment == HorizontalAlignment.RIGHT) {↵ | 32 | else if (alignment == VerticalAlignment.BOTTOM) {↵ | |
31 | startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w;↵ | 33 | startY = chartArea.getMaxY() - bottomSpace - h;↵ | |
32 | }↵ | 34 | }↵ | |
33 | g2.drawImage(this.image, (int) startX, (int) startY, (int) w, (int) h,↵ | 35 | g2.drawImage(this.image, (int) startX, (int) startY, (int) w, (int) h,↵ | |
34 | null);↵ | 36 | null);↵ | |
35 | return new Size2D(chartArea.getWidth() + leftSpace + rightSpace,↵ | 37 | return new Size2D(chartArea.getWidth() + leftSpace + rightSpace,↵ | |
36 | h + topSpace + bottomSpace); | 38 |
| |
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) | 2.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 238 |
Number of mapped statements | 20 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 35.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | double startY = 0.0; | 18 | double startY = 0.0; | |||||||||||||||||||||||||||
2 | double topSpace = 0.0; |
| 7 | double h = getHeight(); | ||||||||||||||||||||||||||
3 | double bottomSpace = 0.0; | 3 | double bottomSpace = 0.0; | |||||||||||||||||||||||||||
4 | double leftSpace = 0.0; | 4 | double leftSpace = 0.0; | |||||||||||||||||||||||||||
5 | double rightSpace = 0.0; | 5 | double rightSpace = 0.0; | |||||||||||||||||||||||||||
6 | double w = getWidth(); | 6 | double w = getWidth(); | |||||||||||||||||||||||||||
7 | double h = getHeight(); |
| 2 | double topSpace = 0.0; | ||||||||||||||||||||||||||
8 | RectangleInsets padding = getPadding(); | 8 | RectangleInsets padding = getPadding(); | |||||||||||||||||||||||||||
9 | topSpace = padding.calculateTopOutset(h); |
| | |||||||||||||||||||||||||||
10 | bottomSpace = padding.calculateBottomOutset(h); |
| | |||||||||||||||||||||||||||
11 | leftSpace = padding.calculateLeftOutset(w); |
| | |||||||||||||||||||||||||||
12 | rightSpace = padding.calculateRightOutset(w); |
| | |||||||||||||||||||||||||||
13 | if (getPosition() == RectangleEdge.TOP) |
| 14 | if (getPosition() == RectangleEdge.LEFT) | ||||||||||||||||||||||||||
14 | startY = chartArea.getY() + topSpace; |
| 15 | startX = chartArea.getX() + leftSpace; | ||||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||||
15 | startY = chartArea.getY() + chartArea.getHeight() - bottomSpace - h; |
| 16 | startX = chartArea.getMaxX() - rightSpace - w; | ||||||||||||||||||||||||||
16 | HorizontalAlignment horizontalAlignment = getHorizontalAlignment(); | | ||||||||||||||||||||||||||||
17 | double startX = 0.0; | 1 | double startX = 0.0; | |||||||||||||||||||||||||||
| 17 | VerticalAlignment alignment = getVerticalAlignment(); | ||||||||||||||||||||||||||||
18 | if (horizontalAlignment == HorizontalAlignment.CENTER) |
| 21 | if (alignment == VerticalAlignment.TOP) | ||||||||||||||||||||||||||
19 | startX = chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0 - w / 2.0; |
| 22 | startY = chartArea.getMinY() + topSpace; | ||||||||||||||||||||||||||
20 | else if (horizontalAlignment == HorizontalAlignment.LEFT) |
| 19 | else if (alignment == VerticalAlignment.CENTER) | ||||||||||||||||||||||||||
21 | startX = chartArea.getX() + leftSpace; |
| 20 | startY = chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0 - h / 2.0; | ||||||||||||||||||||||||||
22 | else if (horizontalAlignment == HorizontalAlignment.RIGHT) |
| 23 | else if (alignment == VerticalAlignment.BOTTOM) | ||||||||||||||||||||||||||
23 | startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w; |
| 24 | startY = chartArea.getMaxY() - bottomSpace - h; | ||||||||||||||||||||||||||
24 | g2.drawImage(this.image, (int)startX, (int)startY, (int)w, (int)h, null); | 25 | g2.drawImage(this.image, (int)startX, (int)startY, (int)w, (int)h, null); | |||||||||||||||||||||||||||
25 | return new Size2D(chartArea.getWidth() + leftSpace + rightSpace, h + topSpace + bottomSpace); | 26 | return new Size2D(chartArea.getWidth() + leftSpace + rightSpace, h + topSpace + bottomSpace); |
Row | Violation |
---|---|
1 | Unmatched statement topSpace=padding.calculateTopOutset(h); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement bottomSpace=padding.calculateBottomOutset(h); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement leftSpace=padding.calculateLeftOutset(w); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement rightSpace=padding.calculateRightOutset(w); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Expression startY cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression startX cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression topSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression leftSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression startY cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression startX cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression h cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression rightSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression chartArea.getY() + chartArea.getHeight() - bottomSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression chartArea.getY() + chartArea.getHeight() - bottomSpace - h cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression chartArea.getMaxX() - rightSpace - w cannot be parameterized, because it has dependencies to/from statements that will be extracted |
16 | Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable alignment |
17 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
18 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.TOP |
19 | Expression startX cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression startY cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Expression chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0 - w / 2.0 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
22 | Expression chartArea.getMinY() + topSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable alignment |
24 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
25 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.LEFT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER |
26 | Expression startX cannot be parameterized, because it has dependencies to/from statements that will be extracted |
27 | Expression startY cannot be parameterized, because it has dependencies to/from statements that will be extracted |
28 | Expression chartArea.getX() + leftSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
29 | Expression chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0 - h / 2.0 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
30 | Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable alignment |
31 | Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment |
32 | Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.RIGHT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.BOTTOM |
33 | Expression startX cannot be parameterized, because it has dependencies to/from statements that will be extracted |
34 | Expression startY cannot be parameterized, because it has dependencies to/from statements that will be extracted |
35 | Expression w cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Expression bottomSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
37 | Expression chartArea.getX() + chartArea.getWidth() - rightSpace cannot be parameterized, because it has dependencies to/from statements that will be extracted |
38 | Expression chartArea.getX() + chartArea.getWidth() - rightSpace - w cannot be parameterized, because it has dependencies to/from statements that will be extracted |
39 | Expression chartArea.getMaxY() - bottomSpace - h cannot be parameterized, because it has dependencies to/from statements that will be extracted |
40 | Clone fragment #1 returns variables topSpace, h, padding, bottomSpace, leftSpace, w, rightSpace , while Clone fragment #2 returns variables padding, topSpace, h, bottomSpace, leftSpace, w, rightSpace |