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: 20 | Number of AST nodes: 20 | |||
1 | RectangleEdge position = getPosition();↵ | 1 | RectangleEdge position = getPosition();↵ | |
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,↵ | 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 | if (this.expandToFitSpace) {↵ | 10 | if (this.expandToFitSpace) {↵ | |
11 | return new Size2D(maxWidth, contentSize.getHeight());↵ | 11 | return new Size2D(maxWidth, contentSize.getHeight());↵ | |
12 | }↵ | 12 | }↵ | |
13 | else {↵ | 13 | else {↵ | |
14 | return contentSize;↵ | 14 | return contentSize;↵ | |
15 | }↵ | 15 | }↵ | |
16 | }↵ | 16 | }↵ | |
17 | else if (position == RectangleEdge.LEFT || position↵ | 17 | else if (position == RectangleEdge.LEFT || position↵ | |
18 | == RectangleEdge.RIGHT) {↵ | 18 | == RectangleEdge.RIGHT) {↵ | |
19 | float maxWidth = Float.MAX_VALUE;↵ | 19 | float maxWidth = (float) heightRange.getUpperBound();↵ | |
20 | g2.setFont(this.font);↵ | 20 | g2.setFont(this.font);↵ | |
21 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | 21 | this.content = TextUtilities.createTextBlock(this.text, this.font,↵ | |
22 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | 22 | this.paint, maxWidth, this.maximumLinesToDisplay,↵ | |
23 | new G2TextMeasurer(g2));↵ | 23 | new G2TextMeasurer(g2));↵ | |
24 | this.content.setLineAlignment(this.textAlignment);↵ | 24 | this.content.setLineAlignment(this.textAlignment);↵ | |
25 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | 25 | Size2D contentSize = this.content.calculateDimensions(g2);↵ | |
26 | // transpose the dimensions, because the title is rotated↵ | 26 | // transpose the dimensions, because the title is rotated↵ | |
27 | if (this.expandToFitSpace) {↵ | 27 | if (this.expandToFitSpace) {↵ | |
28 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | 28 | return new Size2D(contentSize.getHeight(), maxWidth);↵ | |
29 | }↵ | 29 | }↵ | |
30 | else {↵ | 30 | else {↵ | |
31 | return new Size2D(contentSize.height, contentSize.width);↵ | 31 | return new Size2D(contentSize.height, contentSize.width);↵ | |
32 | }↵ | 32 | }↵ | |
33 | }↵ | 33 | }↵ | |
34 | else {↵ | 34 | else {↵ | |
35 | throw new RuntimeException("Unrecognised exception.");↵ | 35 | throw new RuntimeException("Unrecognised exception.");↵ | |
36 | } | 36 |
| |
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 | 116 |
Number of mapped statements | 20 |
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) | 19.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | RectangleEdge position = getPosition(); | 1 | RectangleEdge position = getPosition(); | |||||||||||
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 |
---|