Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getTextAnchor(), position.getAngle(),
position.getRotationAnchor());
if (bounds != null) {
if (!bar.contains(bounds.getBounds2D())) {
if (!negative) {
position = getPositiveItemLabelPositionFallback();
}
else {
position = getNegativeItemLabelPositionFallback();
}
if (position != null) {
anchorPoint = calculateLabelAnchorPoint(
position.getItemLabelAnchor(), bar,
plot.getOrientation());
}
}
}
Shape bounds = TextUtilities.calculateRotatedStringBounds(label,
g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
position.getTextAnchor(), position.getAngle(),
position.getRotationAnchor());
if (bounds != null) {
if (!bar.contains(bounds.getBounds2D())) {
if (!negative) {
position = getPositiveItemLabelPositionFallback();
}
else {
position = getNegativeItemLabelPositionFallback();
}
if (position != null) {
anchorPoint = calculateLabelAnchorPoint(
position.getItemLabelAnchor(), bar,
plot.getOrientation());
}
}
}
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java
|
|
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBarRenderer.java
|
Method name: void drawItemLabel(Graphics2D, CategoryDataset, int, int, CategoryPlot, CategoryItemLabelGenerator, Rectangle2D, boolean)
|
|
Method name: void drawItemLabel(Graphics2D, XYDataset, int, int, XYPlot, XYItemLabelGenerator, Rectangle2D, boolean)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label,↵ | | 1 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label, ↵
|
2 | g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵ | | 2 | g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵
|
3 | position.getTextAnchor(), position.getAngle(),↵ | | 3 | position.getTextAnchor(), position.getAngle(),↵
|
4 | position.getRotationAnchor());↵ | | 4 | position.getRotationAnchor());↵
|
| | | 5 | ↵
|
5 | if (bounds != null) {↵ | | 6 | if (bounds != null) {↵
|
6 | if (!bar.contains(bounds.getBounds2D())) {↵ | | 7 | if (!bar.contains(bounds.getBounds2D())) {↵
|
7 | if (!negative) {↵ | | 8 | if (!negative) {↵
|
8 | position = getPositiveItemLabelPositionFallback();↵ | | 9 | position = getPositiveItemLabelPositionFallback();↵
|
9 | }↵ | | 10 | }↵
|
10 | else {↵ | | 11 | else {↵
|
11 | position = getNegativeItemLabelPositionFallback();↵ | | 12 | position = getNegativeItemLabelPositionFallback();↵
|
12 | }↵ | | 13 | }↵
|
13 | if (position != null) {↵ | | 14 | if (position != null) {↵
|
14 | anchorPoint = calculateLabelAnchorPoint(↵ | | 15 | anchorPoint = calculateLabelAnchorPoint(↵
|
15 | position.getItemLabelAnchor(), bar,↵ | | 16 | position.getItemLabelAnchor(), bar, ↵
|
16 | plot.getOrientation());↵ | | 17 | plot.getOrientation());↵
|
17 | }↵ | | 18 | }↵
|
18 | }↵ | | 19 | }↵
|
19 | } | | 20 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 19 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 8 |
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) | 8.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
14 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); | | 16 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); |
15 | if (bounds != null) | | 17 | if (bounds != null) |
16 | if (!bar.contains(bounds.getBounds2D())) | | 18 | if (!bar.contains(bounds.getBounds2D())) |
17 | | | 19 | |
18 | position = getPositiveItemLabelPositionFallback(); | | 20 | position = getPositiveItemLabelPositionFallback(); |
| | | | |
19 | position = getNegativeItemLabelPositionFallback(); | | 21 | position = getNegativeItemLabelPositionFallback(); |
20 | | | 22 | |
21 | anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); | | 23 | anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); |
Precondition Violations (2)
Row |
Violation |
1 | Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.chart.plot.PlotOrientation getOrientation() |
2 | Clone fragment #1 returns variables position, anchorPoint , while Clone fragment #2 returns variables position, anchorPoint |