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 drawLeftLabels(KeyedValues, Graphics2D, Rectangle2D, Rectangle2D, float, PiePlotState)
|
Method name: void drawRightLabels(KeyedValues, Graphics2D, Rectangle2D, Rectangle2D, float, PiePlotState)
|
|||
Number of AST nodes: 22 | Number of AST nodes: 22 | |||
1 | this.labelDistributor.clear();↵ | 1 | this.labelDistributor.clear();↵ | |
2 | double lGap = plotArea.getWidth() * this.labelGap;↵ | 2 | double lGap = plotArea.getWidth() * this.labelGap;↵ | |
3 | double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;↵ | 3 | double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;↵ | |
4 | for (int i = 0; i < leftKeys.getItemCount(); i++) { ↵ | 4 | for (int i = 0; i < keys.getItemCount(); i++) {↵ | |
5 | String label = this.labelGenerator.generateSectionLabel(↵ | 5 | String label = this.labelGenerator.generateSectionLabel(↵ | |
6 | this.dataset, leftKeys.getKey(i));↵ | 6 | this.dataset, keys.getKey(i));↵ | |
7 | if (label != null) {↵ | 7 | if (label != null) {↵ | |
8 | TextBlock block = TextUtilities.createTextBlock(label, ↵ | 8 | TextBlock block = TextUtilities.createTextBlock(label, ↵ | |
9 | this.labelFont, this.labelPaint, maxLabelWidth, ↵ | 9 | this.labelFont, this.labelPaint, maxLabelWidth, ↵ | |
10 | new G2TextMeasurer(g2));↵ | 10 | new G2TextMeasurer(g2));↵ | |
11 | TextBox labelBox = new TextBox(block);↵ | 11 | TextBox labelBox = new TextBox(block);↵ | |
12 | labelBox.setBackgroundPaint(this.labelBackgroundPaint);↵ | 12 | labelBox.setBackgroundPaint(this.labelBackgroundPaint);↵ | |
13 | labelBox.setOutlinePaint(this.labelOutlinePaint);↵ | 13 | labelBox.setOutlinePaint(this.labelOutlinePaint);↵ | |
14 | labelBox.setOutlineStroke(this.labelOutlineStroke);↵ | 14 | labelBox.setOutlineStroke(this.labelOutlineStroke);↵ | |
15 | labelBox.setShadowPaint(this.labelShadowPaint);↵ | 15 | labelBox.setShadowPaint(this.labelShadowPaint);↵ | |
16 | labelBox.setInteriorGap(this.labelPadding);↵ | 16 | labelBox.setInteriorGap(this.labelPadding);↵ | |
17 | double theta = Math.toRadians(↵ | 17 | double theta = Math.toRadians(↵ | |
18 | leftKeys.getValue(i).doubleValue());↵ | 18 | keys.getValue(i).doubleValue());↵ | |
19 | double baseY = state.getPieCenterY() - Math.sin(theta) ↵ | 19 | double baseY = state.getPieCenterY() ↵ | |
20 | * verticalLinkRadius;↵ | 20 | - Math.sin(theta) * verticalLinkRadius;↵ | |
21 | double hh = labelBox.getHeight(g2);↵ | 21 | double hh = labelBox.getHeight(g2);↵ | |
22 | this.labelDistributor.addPieLabelRecord(new PieLabelRecord(↵ | 22 | this.labelDistributor.addPieLabelRecord(new PieLabelRecord(↵ | |
23 | leftKeys.getKey(i), theta, baseY, labelBox, hh,↵ | 23 | keys.getKey(i), theta, baseY, labelBox, hh,↵ | |
24 | lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 ↵ | 24 | lGap / 2.0 + lGap / 2.0 * Math.cos(theta), ↵ | |
25 | + getExplodePercent(leftKeys.getKey(i))));↵ | 25 | 0.9 + getExplodePercent(keys.getKey(i))));↵ | |
26 | }↵ | 26 | }↵ | |
27 | }↵ | 27 | }↵ | |
28 | double hh = plotArea.getHeight();↵ | 28 | double hh = plotArea.getHeight();↵ | |
29 | double gap = hh * getInteriorGap();↵ | 29 | double gap = hh * getInteriorGap();↵ | |
30 | this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, ↵ | 30 | this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, ↵ | |
31 | hh - 2 * gap);↵ | 31 | hh - 2 * gap);↵ | |
32 | for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {↵ | 32 | for (int i = 0; i < this.labelDistributor.getItemCount(); i++) {↵ | |
33 | drawLeftLabel(g2, state, ↵ | 33 | drawRightLabel(g2, state, ↵ | |
34 | this.labelDistributor.getPieLabelRecord(i));↵ | 34 | this.labelDistributor.getPieLabelRecord(i));↵ | |
35 | } | 35 |
| |
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.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 190 |
Number of mapped statements | 22 |
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) | 248.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | this.labelDistributor.clear(); | 1 | this.labelDistributor.clear(); | |||||||||||||||||||
2 | double lGap = plotArea.getWidth() * this.labelGap; | 2 | double lGap = plotArea.getWidth() * this.labelGap; | |||||||||||||||||||
3 | double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0; | 3 | double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0; | |||||||||||||||||||
4 | for (int i = 0; i < leftKeys.getItemCount(); i++) |
| 4 | for (int i = 0; i < keys.getItemCount(); i++) | ||||||||||||||||||
5 | String label = this.labelGenerator.generateSectionLabel(this.dataset, leftKeys.getKey(i)); |
| 5 | String label = this.labelGenerator.generateSectionLabel(this.dataset, keys.getKey(i)); | ||||||||||||||||||
6 | if (label != null) | 6 | if (label != null) | |||||||||||||||||||
7 | TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); | 7 | TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); | |||||||||||||||||||
8 | TextBox labelBox = new TextBox(block); | 8 | TextBox labelBox = new TextBox(block); | |||||||||||||||||||
9 | labelBox.setBackgroundPaint(this.labelBackgroundPaint); | 9 | labelBox.setBackgroundPaint(this.labelBackgroundPaint); | |||||||||||||||||||
10 | labelBox.setOutlinePaint(this.labelOutlinePaint); | 10 | labelBox.setOutlinePaint(this.labelOutlinePaint); | |||||||||||||||||||
11 | labelBox.setOutlineStroke(this.labelOutlineStroke); | 11 | labelBox.setOutlineStroke(this.labelOutlineStroke); | |||||||||||||||||||
12 | labelBox.setShadowPaint(this.labelShadowPaint); | 12 | labelBox.setShadowPaint(this.labelShadowPaint); | |||||||||||||||||||
13 | labelBox.setInteriorGap(this.labelPadding); | 13 | labelBox.setInteriorGap(this.labelPadding); | |||||||||||||||||||
14 | double theta = Math.toRadians(leftKeys.getValue(i).doubleValue()); |
| 14 | double theta = Math.toRadians(keys.getValue(i).doubleValue()); | ||||||||||||||||||
15 | double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius; | 15 | double baseY = state.getPieCenterY() - Math.sin(theta) * verticalLinkRadius; | |||||||||||||||||||
16 | double hh = labelBox.getHeight(g2); | 16 | double hh = labelBox.getHeight(g2); | |||||||||||||||||||
17 | this.labelDistributor.addPieLabelRecord(new PieLabelRecord(leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9 + getExplodePercent(leftKeys.getKey(i)))); |
| 17 | this.labelDistributor.addPieLabelRecord(new PieLabelRecord(keys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * Math.cos(theta), 0.9 + getExplodePercent(keys.getKey(i)))); | ||||||||||||||||||
18 | double hh = plotArea.getHeight(); | 18 | double hh = plotArea.getHeight(); | |||||||||||||||||||
19 | double gap = hh * getInteriorGap(); | 19 | double gap = hh * getInteriorGap(); | |||||||||||||||||||
20 | this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap); | 20 | this.labelDistributor.distributeLabels(plotArea.getMinY() + gap, hh - 2 * gap); | |||||||||||||||||||
21 | for (int i = 0; i < this.labelDistributor.getItemCount(); i++) | 21 | for (int i = 0; i < this.labelDistributor.getItemCount(); i++) | |||||||||||||||||||
22 | drawLeftLabel(g2, state, this.labelDistributor.getPieLabelRecord(i)); |
| 22 | drawRightLabel(g2, state, this.labelDistributor.getPieLabelRecord(i)); |
Row | Violation |
---|---|
1 | Expression -Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression Math.cos(theta) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression drawLeftLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized |
6 | Expression drawRightLabel(g2,state,this.labelDistributor.getPieLabelRecord(i)) is a void method call, and thus it cannot be parameterized |