File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java | |||
Method name: double findMaximumTickLabelHeight(List, Graphics2D, Rectangle2D, boolean)
|
Method name: double findMaximumTickLabelWidth(List, Graphics2D, Rectangle2D, boolean)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | RectangleInsets insets = getTickLabelInsets();↵ | 1 | RectangleInsets insets = getTickLabelInsets();↵ | |
2 | Font font = getTickLabelFont();↵ | 2 | Font font = getTickLabelFont();↵ | |
3 | double maxHeight = 0.0;↵ | 3 | double maxWidth = 0.0;↵ | |
4 | if (vertical) {↵ | 4 | if (!vertical) {↵ | |
5 | FontMetrics fm = g2.getFontMetrics(font);↵ | 5 | FontMetrics fm = g2.getFontMetrics(font);↵ | |
6 | Iterator iterator = ticks.iterator();↵ | 6 | Iterator iterator = ticks.iterator();↵ | |
7 | while (iterator.hasNext()) {↵ | 7 | while (iterator.hasNext()) {↵ | |
8 | Tick tick = (Tick) iterator.next();↵ | 8 | Tick tick = (Tick) iterator.next();↵ | |
9 | Rectangle2D labelBounds = TextUtilities.getTextBounds(↵ | 9 | Rectangle2D labelBounds = TextUtilities.getTextBounds(↵ | |
10 | tick.getText(), g2, fm);↵ | 10 | tick.getText(), g2, fm);↵ | |
11 | if (labelBounds.getWidth() + insets.getTop()↵ | 11 | if (labelBounds.getWidth() + insets.getLeft()↵ | |
12 | + insets.getBottom() > maxHeight) {↵ | 12 | + insets.getRight() > maxWidth) {↵ | |
13 | maxHeight = labelBounds.getWidth()↵ | 13 | maxWidth = labelBounds.getWidth()↵ | |
14 | + insets.getTop() + insets.getBottom();↵ | 14 | + insets.getLeft() + insets.getRight();↵ | |
15 | }↵ | 15 | }↵ | |
16 | }↵ | 16 | }↵ | |
17 | }↵ | 17 | }↵ | |
18 | else {↵ | 18 | else {↵ | |
19 | LineMetrics metrics = font.getLineMetrics("ABCxyz",↵ | 19 | LineMetrics metrics = font.getLineMetrics("ABCxyz",↵ | |
20 | g2.getFontRenderContext());↵ | 20 | g2.getFontRenderContext());↵ | |
21 | maxHeight = metrics.getHeight()↵ | 21 | maxWidth = metrics.getHeight()↵ | |
22 | + insets.getTop() + insets.getBottom();↵ | 22 | + insets.getTop() + insets.getBottom();↵ | |
23 | }↵ | 23 | }↵ | |
24 | return maxHeight; | 24 | return maxWidth; | |
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) | 0.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 54 |
Number of mapped statements | 14 |
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) | 40.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | RectangleInsets insets = getTickLabelInsets(); | 1 | RectangleInsets insets = getTickLabelInsets(); | |||||||||||||||||||||
2 | Font font = getTickLabelFont(); | 2 | Font font = getTickLabelFont(); | |||||||||||||||||||||
3 | double maxHeight = 0.0; |
| 3 | double maxWidth = 0.0; | ||||||||||||||||||||
4 | if (vertical) |
| 4 | if (!vertical) | ||||||||||||||||||||
5 | FontMetrics fm = g2.getFontMetrics(font); | 5 | FontMetrics fm = g2.getFontMetrics(font); | |||||||||||||||||||||
6 | Iterator iterator = ticks.iterator(); | 6 | Iterator iterator = ticks.iterator(); | |||||||||||||||||||||
7 | while (iterator.hasNext()) | 7 | while (iterator.hasNext()) | |||||||||||||||||||||
8 | Tick tick = (Tick)iterator.next(); | 8 | Tick tick = (Tick)iterator.next(); | |||||||||||||||||||||
9 | Rectangle2D labelBounds = TextUtilities.getTextBounds(tick.getText(), g2, fm); | 9 | Rectangle2D labelBounds = TextUtilities.getTextBounds(tick.getText(), g2, fm); | |||||||||||||||||||||
10 | if (labelBounds.getWidth() + insets.getTop() + insets.getBottom() > maxHeight) |
| 10 | if (labelBounds.getWidth() + insets.getLeft() + insets.getRight() > maxWidth) | ||||||||||||||||||||
11 | maxHeight = labelBounds.getWidth() + insets.getTop() + insets.getBottom(); |
| 11 | maxWidth = labelBounds.getWidth() + insets.getLeft() + insets.getRight(); | ||||||||||||||||||||
else | else | |||||||||||||||||||||||
12 | LineMetrics metrics = font.getLineMetrics("ABCxyz", g2.getFontRenderContext()); | 12 | LineMetrics metrics = font.getLineMetrics("ABCxyz", g2.getFontRenderContext()); | |||||||||||||||||||||
13 | maxHeight = metrics.getHeight() + insets.getTop() + insets.getBottom(); |
| 13 | maxWidth = metrics.getHeight() + insets.getTop() + insets.getBottom(); | ||||||||||||||||||||
14 | return maxHeight; |
| 14 | return maxWidth; |
Row | Violation |
---|---|
1 | Expression insets.getBottom() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression insets.getRight() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression insets.getTop() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression insets.getLeft() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression insets.getBottom() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression insets.getRight() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression insets.getTop() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression insets.getLeft() cannot be parameterized, because it has dependencies to/from statements that will be extracted |