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: 23 | Number of AST nodes: 25 | |||
1 | if (generator == null) {↵ | |||
2 | return; // nothing to do↵ | |||
3 | }↵ | |||
1 | String label = generator.generateLabel(data, row, column);↵ | 4 | String label = generator.generateLabel(dataset, series, item);↵ | |
2 | if (label == null) {↵ | 5 | if (label == null) {↵ | |
3 | return; // nothing to do↵ | 6 | return; // nothing to do ↵ | |
4 | }↵ | 7 | }↵ | |
8 | ↵ | |||
5 | Font labelFont = getItemLabelFont(row, column);↵ | 9 | Font labelFont = getItemLabelFont(series, item);↵ | |
6 | g2.setFont(labelFont);↵ | 10 | g2.setFont(labelFont);↵ | |
7 | Paint paint = getItemLabelPaint(row, column);↵ | 11 | Paint paint = getItemLabelPaint(series, item);↵ | |
8 | g2.setPaint(paint);↵ | 12 | g2.setPaint(paint);↵ | |
9 | // find out where to place the label...↵ | 13 | // find out where to place the label...↵ | |
10 | ItemLabelPosition position = null;↵ | 14 | ItemLabelPosition position = null;↵ | |
11 | if (!negative) {↵ | 15 | if (!negative) {↵ | |
12 | position = getPositiveItemLabelPosition(row, column);↵ | 16 | position = getPositiveItemLabelPosition(series, item);↵ | |
13 | }↵ | 17 | }↵ | |
14 | else {↵ | 18 | else {↵ | |
15 | position = getNegativeItemLabelPosition(row, column);↵ | 19 | position = getNegativeItemLabelPosition(series, item);↵ | |
16 | }↵ | 20 | }↵ | |
17 | // work out the label anchor point...↵ | 21 | // work out the label anchor point...↵ | |
18 | Point2D anchorPoint = calculateLabelAnchorPoint(↵ | 22 | Point2D anchorPoint = calculateLabelAnchorPoint(↵ | |
19 | position.getItemLabelAnchor(), bar, plot.getOrientation());↵ | 23 | position.getItemLabelAnchor(), bar, plot.getOrientation());↵ | |
24 | ↵ | |||
20 | if (isInternalAnchor(position.getItemLabelAnchor())) {↵ | 25 | if (isInternalAnchor(position.getItemLabelAnchor())) {↵ | |
21 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label,↵ | 26 | Shape bounds = TextUtilities.calculateRotatedStringBounds(label, ↵ | |
22 | g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵ | 27 | g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵ | |
23 | position.getTextAnchor(), position.getAngle(),↵ | 28 | position.getTextAnchor(), position.getAngle(),↵ | |
24 | position.getRotationAnchor());↵ | 29 | position.getRotationAnchor());↵ | |
30 | ↵ | |||
25 | if (bounds != null) {↵ | 31 | if (bounds != null) {↵ | |
26 | if (!bar.contains(bounds.getBounds2D())) {↵ | 32 | if (!bar.contains(bounds.getBounds2D())) {↵ | |
27 | if (!negative) {↵ | 33 | if (!negative) {↵ | |
28 | position = getPositiveItemLabelPositionFallback();↵ | 34 | position = getPositiveItemLabelPositionFallback();↵ | |
29 | }↵ | 35 | }↵ | |
30 | else {↵ | 36 | else {↵ | |
31 | position = getNegativeItemLabelPositionFallback();↵ | 37 | position = getNegativeItemLabelPositionFallback();↵ | |
32 | }↵ | 38 | }↵ | |
33 | if (position != null) {↵ | 39 | if (position != null) {↵ | |
34 | anchorPoint = calculateLabelAnchorPoint(↵ | 40 | anchorPoint = calculateLabelAnchorPoint(↵ | |
35 | position.getItemLabelAnchor(), bar,↵ | 41 | position.getItemLabelAnchor(), bar, ↵ | |
36 | plot.getOrientation());↵ | 42 | plot.getOrientation());↵ | |
37 | }↵ | 43 | }↵ | |
38 | }↵ | 44 | }↵ | |
39 | }↵ | 45 | }↵ | |
46 | ↵ | |||
40 | }↵ | 47 | }↵ | |
48 | ↵ | |||
41 | if (position != null) {↵ | 49 | if (position != null) {↵ | |
42 | TextUtilities.drawRotatedString(label, g2,↵ | 50 | TextUtilities.drawRotatedString(label, g2, ↵ | |
43 | (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵ | 51 | (float) anchorPoint.getX(), (float) anchorPoint.getY(),↵ | |
44 | position.getTextAnchor(), position.getAngle(),↵ | 52 | position.getTextAnchor(), position.getAngle(), ↵ | |
45 | position.getRotationAnchor());↵ | 53 | position.getRotationAnchor());↵ | |
46 | } | 54 |
| |
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) | 1.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 97 |
Number of mapped statements | 23 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 40.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | if (generator == null) | ||||||||||||||||||||||||||
|
| 2 | return; | |||||||||||||||||||||||||
1 | String label = generator.generateLabel(data, row, column); |
| 3 | String label = generator.generateLabel(dataset, series, item); | ||||||||||||||||||||||||
2 | if (label == null) | 4 | if (label == null) | |||||||||||||||||||||||||
3 | return; | 5 | return; | |||||||||||||||||||||||||
4 | Font labelFont = getItemLabelFont(row, column); |
| 6 | Font labelFont = getItemLabelFont(series, item); | ||||||||||||||||||||||||
5 | g2.setFont(labelFont); | 7 | g2.setFont(labelFont); | |||||||||||||||||||||||||
6 | Paint paint = getItemLabelPaint(row, column); |
| 8 | Paint paint = getItemLabelPaint(series, item); | ||||||||||||||||||||||||
7 | g2.setPaint(paint); | 9 | g2.setPaint(paint); | |||||||||||||||||||||||||
8 | ItemLabelPosition position = null; | 10 | ItemLabelPosition position = null; | |||||||||||||||||||||||||
9 | if (!negative) | 11 | if (!negative) | |||||||||||||||||||||||||
10 | position = getPositiveItemLabelPosition(row, column); |
| 12 | position = getPositiveItemLabelPosition(series, item); | ||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||
11 | position = getNegativeItemLabelPosition(row, column); |
| 13 | position = getNegativeItemLabelPosition(series, item); | ||||||||||||||||||||||||
12 | Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); |
| 14 | Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); | ||||||||||||||||||||||||
13 | if (isInternalAnchor(position.getItemLabelAnchor())) | 15 | if (isInternalAnchor(position.getItemLabelAnchor())) | |||||||||||||||||||||||||
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 | if (!negative) | 19 | if (!negative) | |||||||||||||||||||||||||
18 | position = getPositiveItemLabelPositionFallback(); | 20 | position = getPositiveItemLabelPositionFallback(); | |||||||||||||||||||||||||
else | else | |||||||||||||||||||||||||||
19 | position = getNegativeItemLabelPositionFallback(); | 21 | position = getNegativeItemLabelPositionFallback(); | |||||||||||||||||||||||||
20 | if (position != null) | 22 | if (position != null) | |||||||||||||||||||||||||
21 | anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); |
| 23 | anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), bar, plot.getOrientation()); | ||||||||||||||||||||||||
22 | if (position != null) | 24 | if (position != null) | |||||||||||||||||||||||||
23 | TextUtilities.drawRotatedString(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); | 25 | TextUtilities.drawRotatedString(label, g2, (float)anchorPoint.getX(), (float)anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); |
Row | Violation |
---|---|
1 | Unmatched return; |
2 | Expression data cannot be unified with expression dataset , because common superclass type org.jfree.data.general.Dataset cannot be passed as an argument to public abstract java.lang.String generateLabel(org.jfree.data.category.CategoryDataset, int, int) |
3 | Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable generator does not match with type org.jfree.chart.labels.XYItemLabelGenerator of variable generator |
4 | 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() |
5 | 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() |