File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java | |||
Method name: void drawLeftLabel(Graphics2D, PiePlotState, PieLabelRecord)
|
Method name: void drawRightLabel(Graphics2D, PiePlotState, PieLabelRecord)
|
|||
Number of AST nodes: 28 | Number of AST nodes: 28 | |||
1 | double anchorX = state.getLinkArea().getMinX();↵ | 1 | double anchorX = state.getLinkArea().getMaxX();↵ | |
2 | double targetX = anchorX - record.getGap();↵ | 2 | double targetX = anchorX + record.getGap();↵ | |
3 | double targetY = record.getAllocatedY();↵ | 3 | double targetY = record.getAllocatedY();↵ | |
4 | ↵ | 4 | ↵ | |
5 | if (this.labelLinksVisible) {↵ | 5 | if (this.labelLinksVisible) {↵ | |
6 | double theta = record.getAngle();↵ | 6 | double theta = record.getAngle();↵ | |
7 | double linkX = state.getPieCenterX() + Math.cos(theta) ↵ | 7 | double linkX = state.getPieCenterX() + Math.cos(theta) ↵ | |
8 | * state.getPieWRadius() * record.getLinkPercent();↵ | 8 | * state.getPieWRadius() * record.getLinkPercent();↵ | |
9 | double linkY = state.getPieCenterY() - Math.sin(theta) ↵ | 9 | double linkY = state.getPieCenterY() - Math.sin(theta) ↵ | |
10 | * state.getPieHRadius() * record.getLinkPercent();↵ | 10 | * state.getPieHRadius() * record.getLinkPercent();↵ | |
11 | double elbowX = state.getPieCenterX() + Math.cos(theta) ↵ | 11 | double elbowX = state.getPieCenterX() + Math.cos(theta) ↵ | |
12 | * state.getLinkArea().getWidth() / 2.0;↵ | 12 | * state.getLinkArea().getWidth() / 2.0;↵ | |
13 | double elbowY = state.getPieCenterY() - Math.sin(theta) ↵ | 13 | double elbowY = state.getPieCenterY() - Math.sin(theta) ↵ | |
14 | * state.getLinkArea().getHeight() / 2.0;↵ | 14 | * state.getLinkArea().getHeight() / 2.0;↵ | |
15 | double anchorY = elbowY;↵ | 15 | double anchorY = elbowY;↵ | |
16 | g2.setPaint(this.labelLinkPaint);↵ | 16 | g2.setPaint(this.labelLinkPaint);↵ | |
17 | g2.setStroke(this.labelLinkStroke);↵ | 17 | g2.setStroke(this.labelLinkStroke);↵ | |
18 | PieLabelLinkStyle style = getLabelLinkStyle();↵ | 18 | PieLabelLinkStyle style = getLabelLinkStyle();↵ | |
19 | if (style.equals(PieLabelLinkStyle.STANDARD)) {↵ | 19 | if (style.equals(PieLabelLinkStyle.STANDARD)) {↵ | |
20 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));↵ | 20 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));↵ | |
21 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));↵ | 21 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));↵ | |
22 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));↵ | 22 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));↵ | |
23 | }↵ | 23 | }↵ | |
24 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {↵ | 24 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {↵ | |
25 | QuadCurve2D q = new QuadCurve2D.Float();↵ | 25 | QuadCurve2D q = new QuadCurve2D.Float();↵ | |
26 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);↵ | 26 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);↵ | |
27 | g2.draw(q);↵ | 27 | g2.draw(q);↵ | |
28 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); ↵ | 28 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); ↵ | |
29 | }↵ | 29 | }↵ | |
30 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {↵ | 30 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {↵ | |
31 | CubicCurve2D c = new CubicCurve2D .Float();↵ | 31 | CubicCurve2D c = new CubicCurve2D .Float();↵ | |
32 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, ↵ | 32 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, ↵ | |
33 | linkX, linkY);↵ | 33 | linkX, linkY);↵ | |
34 | g2.draw(c);↵ | 34 | g2.draw(c);↵ | |
35 | }↵ | 35 | }↵ | |
36 | }↵ | 36 | }↵ | |
37 | ↵ | |||
37 | TextBox tb = record.getLabel();↵ | 38 | TextBox tb = record.getLabel();↵ | |
38 | tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT); | 39 | tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT); | |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 241 |
Number of mapped statements | 28 |
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) | 56.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | double anchorX = state.getLinkArea().getMinX(); |
| 1 | double anchorX = state.getLinkArea().getMaxX(); | ||||||||||||
2 | double targetX = anchorX - record.getGap(); |
| 2 | double targetX = anchorX + record.getGap(); | ||||||||||||
3 | double targetY = record.getAllocatedY(); | 3 | double targetY = record.getAllocatedY(); | |||||||||||||
4 | if (this.labelLinksVisible) | 4 | if (this.labelLinksVisible) | |||||||||||||
5 | double theta = record.getAngle(); | 5 | double theta = record.getAngle(); | |||||||||||||
6 | double linkX = state.getPieCenterX() + Math.cos(theta) * state.getPieWRadius() * record.getLinkPercent(); | 6 | double linkX = state.getPieCenterX() + Math.cos(theta) * state.getPieWRadius() * record.getLinkPercent(); | |||||||||||||
7 | double linkY = state.getPieCenterY() - Math.sin(theta) * state.getPieHRadius() * record.getLinkPercent(); | 7 | double linkY = state.getPieCenterY() - Math.sin(theta) * state.getPieHRadius() * record.getLinkPercent(); | |||||||||||||
8 | double elbowX = state.getPieCenterX() + Math.cos(theta) * state.getLinkArea().getWidth() / 2.0; | 8 | double elbowX = state.getPieCenterX() + Math.cos(theta) * state.getLinkArea().getWidth() / 2.0; | |||||||||||||
9 | double elbowY = state.getPieCenterY() - Math.sin(theta) * state.getLinkArea().getHeight() / 2.0; | 9 | double elbowY = state.getPieCenterY() - Math.sin(theta) * state.getLinkArea().getHeight() / 2.0; | |||||||||||||
10 | double anchorY = elbowY; | 10 | double anchorY = elbowY; | |||||||||||||
11 | g2.setPaint(this.labelLinkPaint); | 11 | g2.setPaint(this.labelLinkPaint); | |||||||||||||
12 | g2.setStroke(this.labelLinkStroke); | 12 | g2.setStroke(this.labelLinkStroke); | |||||||||||||
13 | PieLabelLinkStyle style = getLabelLinkStyle(); | 13 | PieLabelLinkStyle style = getLabelLinkStyle(); | |||||||||||||
14 | if (style.equals(PieLabelLinkStyle.STANDARD)) | 14 | if (style.equals(PieLabelLinkStyle.STANDARD)) | |||||||||||||
15 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY)); | 15 | g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY)); | |||||||||||||
16 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY)); | 16 | g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY)); | |||||||||||||
17 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY)); | 17 | g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY)); | |||||||||||||
18 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) | 18 | else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) | |||||||||||||
19 | QuadCurve2D q = new QuadCurve2D.Float(); | 19 | QuadCurve2D q = new QuadCurve2D.Float(); | |||||||||||||
20 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY); | 20 | q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY); | |||||||||||||
21 | g2.draw(q); | 21 | g2.draw(q); | |||||||||||||
22 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); | 22 | g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY)); | |||||||||||||
23 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) | 23 | else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) | |||||||||||||
24 | CubicCurve2D c = new CubicCurve2D.Float(); | 24 | CubicCurve2D c = new CubicCurve2D.Float(); | |||||||||||||
25 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, linkX, linkY); | 25 | c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY, linkX, linkY); | |||||||||||||
26 | g2.draw(c); | 26 | g2.draw(c); | |||||||||||||
27 | TextBox tb = record.getLabel(); | 27 | TextBox tb = record.getLabel(); | |||||||||||||
28 | tb.draw(g2, (float)targetX, (float)targetY, RectangleAnchor.RIGHT); |
| 28 | tb.draw(g2, (float)targetX, (float)targetY, RectangleAnchor.LEFT); |
Row | Violation |
---|---|
1 | Expression anchorX - record.getGap() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression anchorX + record.getGap() cannot be parameterized, because it has dependencies to/from statements that will be extracted |