File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java | |||
Method name: Size2D arrangeFN(Graphics2D, double)
|
Method name: Size2D arrangeRR(Graphics2D, Range, Range)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if (position == RectangleEdge.LEFT || position↵ | 1 | if (position == RectangleEdge.LEFT || position↵ | |
2 | == RectangleEdge.RIGHT) {↵ | 2 | == RectangleEdge.RIGHT) {↵ | |
3 | float maxWidth = Float.MAX_VALUE;↵ | 3 | float maxWidth = (float) heightRange.getUpperBound();↵ | |
4 | g2.setFont(this.font);↵ | 4 | g2.setFont(this.font);↵ | |
5 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | 5 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | |
6 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | 6 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | |
7 | new G2TextMeasurer(g2));↵ | 7 | new G2TextMeasurer(g2));↵ | |
8 | this.content.setLineAlignment(this.textAlignment);↵ | 8 | this.content.setLineAlignment(this.textAlignment);↵ | |
9 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | 9 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | |
10 | // transpose the dimensions, because the title is rotated↵ | 10 | // transpose the dimensions, because the title is rotated↵ | |
11 | if (this.expandToFitSpace) {↵ | 11 | if (this.expandToFitSpace) {↵ | |
12 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | 12 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | |
13 | }↵ | 13 | }↵ | |
14 | else {↵ | 14 | else {↵ | |
15 | return new Size2D(contentSize.height, contentSize.width);↵ | 15 | return new Size2D(contentSize.height, contentSize.width);↵ | |
16 | }↵ | 16 | }↵ | |
17 | }↵ | 17 | }↵ | |
18 | else {↵ | 18 | else {↵ | |
19 | throw new RuntimeException("Unrecognised exception.");↵ | 19 | throw new RuntimeException("Unrecognised exception.");↵ | |
20 | } | 20 |
| |
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) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 58 |
Number of mapped statements | 10 |
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) | 7.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) | 11 | else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) | |||||||||||
12 | float maxWidth = Float.MAX_VALUE; |
| 12 | float maxWidth = (float)heightRange.getUpperBound(); | ||||||||||
13 | g2.setFont(this.font); | 13 | g2.setFont(this.font); | |||||||||||
14 | this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); | 14 | this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); | |||||||||||
15 | this.content.setLineAlignment(this.textAlignment); | 15 | this.content.setLineAlignment(this.textAlignment); | |||||||||||
16 | Size2D contentSize = this.content.calculateDimensions(g2); | 16 | Size2D contentSize = this.content.calculateDimensions(g2); | |||||||||||
17 | if (this.expandToFitSpace) | 17 | if (this.expandToFitSpace) | |||||||||||
18 | return new Size2D(contentSize.getHeight(), maxWidth); | 18 | return new Size2D(contentSize.getHeight(), maxWidth); | |||||||||||
else | else | |||||||||||||
19 | return new Size2D(contentSize.height, contentSize.width); | 19 | return new Size2D(contentSize.height, contentSize.width); | |||||||||||
else | else | |||||||||||||
20 | throw new RuntimeException("Unrecognised exception."); | 20 | throw new RuntimeException("Unrecognised exception."); |
Row | Violation |
---|---|
1 | Not all possible execution flows end in a return statement |