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: 19 | Number of AST nodes: 19 | |||
1 | if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {↵ | 1 | if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {↵ | |
2 | float maxWidth = (float) w;↵ | 2 | float maxWidth = (float) widthRange.getUpperBound();↵ | |
3 | g2.setFont(this.font);↵ | 3 | g2.setFont(this.font);↵ | |
4 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | 4 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | |
5 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | 5 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | |
6 | new G2TextMeasurer(g2));↵ | 6 | new G2TextMeasurer(g2));↵ | |
7 | this.content.setLineAlignment(this.textAlignment);↵ | 7 | this.content.setLineAlignment(this.textAlignment);↵ | |
8 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | 8 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | |
9 | if (this.expandToFitSpace) {↵ | 9 | if (this.expandToFitSpace) {↵ | |
10 | return new Size2D(maxWidth, contentSize.getHeight());↵ | 10 | return new Size2D(maxWidth, contentSize.getHeight());↵ | |
11 | }↵ | 11 | }↵ | |
12 | else {↵ | 12 | else {↵ | |
13 | return contentSize;↵ | 13 | return contentSize;↵ | |
14 | }↵ | 14 | }↵ | |
15 | }↵ | 15 | }↵ | |
16 | else if (position == RectangleEdge.LEFT || position↵ | 16 | else if (position == RectangleEdge.LEFT || position↵ | |
17 | == RectangleEdge.RIGHT) {↵ | 17 | == RectangleEdge.RIGHT) {↵ | |
18 | float maxWidth = Float.MAX_VALUE;↵ | 18 | float maxWidth = (float) heightRange.getUpperBound();↵ | |
19 | g2.setFont(this.font);↵ | 19 | g2.setFont(this.font);↵ | |
20 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | 20 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | |
21 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | 21 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | |
22 | new G2TextMeasurer(g2));↵ | 22 | new G2TextMeasurer(g2));↵ | |
23 | this.content.setLineAlignment(this.textAlignment);↵ | 23 | this.content.setLineAlignment(this.textAlignment);↵ | |
24 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | 24 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | |
25 | // transpose the dimensions, because the title is rotated↵ | 25 | // transpose the dimensions, because the title is rotated↵ | |
26 | if (this.expandToFitSpace) {↵ | 26 | if (this.expandToFitSpace) {↵ | |
27 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | 27 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | |
28 | }↵ | 28 | }↵ | |
29 | else {↵ | 29 | else {↵ | |
30 | return new Size2D(contentSize.height, contentSize.width);↵ | 30 | return new Size2D(contentSize.height, contentSize.width);↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | else {↵ | 33 | else {↵ | |
34 | throw new RuntimeException("Unrecognised exception.");↵ | 34 | throw new RuntimeException("Unrecognised exception.");↵ | |
35 | } | 35 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 115 |
Number of mapped statements | 19 |
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) | 12.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) | 2 | if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) | |||||||||||
3 | float maxWidth = (float)w; |
| 3 | float maxWidth = (float)widthRange.getUpperBound(); | ||||||||||
4 | g2.setFont(this.font); | 4 | g2.setFont(this.font); | |||||||||||
5 | this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); | 5 | this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2)); | |||||||||||
6 | this.content.setLineAlignment(this.textAlignment); | 6 | this.content.setLineAlignment(this.textAlignment); | |||||||||||
7 | Size2D contentSize = this.content.calculateDimensions(g2); | 7 | Size2D contentSize = this.content.calculateDimensions(g2); | |||||||||||
8 | if (this.expandToFitSpace) | 8 | if (this.expandToFitSpace) | |||||||||||
9 | return new Size2D(maxWidth, contentSize.getHeight()); | 9 | return new Size2D(maxWidth, contentSize.getHeight()); | |||||||||||
else | else | |||||||||||||
10 | return contentSize; | 10 | return contentSize; | |||||||||||
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 |
---|