EntityCollection entities = state.getEntityCollection();
if (entities != null) {
String tip = null;
PieToolTipGenerator toolTipGenerator
= getToolTipGenerator();
if (toolTipGenerator != null) {
tip = toolTipGenerator.generateToolTip(dataset,
key);
}
String url = null;
PieURLGenerator urlGenerator = getURLGenerator();
if (urlGenerator != null) {
url = urlGenerator.generateURL(dataset, key,
getPieIndex());
}
PieSectionEntity entity = new PieSectionEntity(path,
dataset, getPieIndex(), section, key, tip,
url);
entities.add(entity);
}
if (entityArea == null) {
entityArea = line.getBounds();
}
String tip = null;
XYToolTipGenerator generator = getToolTipGenerator(series, item);
if (generator != null) {
tip = generator.generateToolTip(dataset, series, item);
}
String url = null;
if (getURLGenerator() != null) {
url = getURLGenerator().generateURL(dataset, series, item);
}
XYItemEntity entity = new XYItemEntity(entityArea, dataset, series,
item, tip, url);
entities.add(entity);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/RingPlot.java
|
|
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/YIntervalRenderer.java
|
Method name: void drawItem(Graphics2D, int, Rectangle2D, PiePlotState, int)
|
|
Method name: void drawItem(Graphics2D, XYItemRendererState, Rectangle2D, PlotRenderingInfo, XYPlot, ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int)
|
Number of AST nodes: 12
|
|
Number of AST nodes: 11
|
|
1 | EntityCollection entities = state.getEntityCollection();↵ | | 1 | if (entityArea == null) {↵
|
2 | if (entities != null) {↵ | | 2 | entityArea = line.getBounds();↵
|
3 | ↵ | | 3 | }↵
|
4 | String tip = null;↵ | | 4 | String tip = null;↵
|
5 | PieToolTipGenerator toolTipGenerator ↵ | | 5 | XYToolTipGenerator generator ↵
|
6 | = getToolTipGenerator();↵ | | 6 | = getToolTipGenerator(↵
|
7 | if (toolTipG↵ | | 7 | series, item);↵
|
8 | enerator != null) {↵ | | 8 | if (generator != null) {↵
|
9 | tip = toolTipGenerator.generateToolTip(dataset, ↵ | | 9 | tip = generator.generateToolTip(dataset, ↵
|
10 | key);↵ | | |
|
11 | }↵ | | |
|
12 | ↵ | | 10 | series, item);↵
|
| | | 11 | }↵
|
13 | String url = null;↵ | | 12 | String url = null;↵
|
14 | PieURLGenerator urlGenerator = getURLGenerator();↵ | | 13 | ↵
|
15 | if (urlGenerator != null) {↵ | | 14 | if (getURLGenerator() != null) {↵
|
16 | url = urlGenerator.generateURL(dataset, key, ↵ | | 15 | url = getURLGenerator().generateURL(dataset, ↵
|
17 | getPieIndex());↵ | | |
|
18 | ↵ | | 16 | series, item);↵
|
19 | }↵ | | 17 | }↵
|
20 | PieSectionEntity entity = new PieSectionEntity(path, ↵ | | 18 | XYItemEntity entity = new ↵
|
21 | dataset, getPieIndex(), section, key, tip, ↵ | | |
|
22 | url);↵ | | |
|
23 | ↵ | | 19 | XYItemEntity(entityArea, dataset, series,↵
|
| | | 20 | item, tip, url);↵
|
24 | entities.add(entity);↵ | | 21 | entities.add(entity);
|
25 | } | | | |
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 |
Number of node comparisons | 14 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 2.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
58 | String tip = null; | | 40 | String tip = null; |
| | | 41 | XYToolTipGenerator generator = getToolTipGenerator(series, item); |
59 | PieToolTipGenerator toolTipGenerator = getToolTipGenerator(); | | | |
60 | if (toolTipGenerator != null) | | 42 | if (generator != null) |
| | | 43 | tip = generator.generateToolTip(dataset, series, item); |
61 | tip = toolTipGenerator.generateToolTip(dataset, key); | | | |
Precondition Violations (4)
Row |
Violation |
1 | Type org.jfree.chart.labels.PieToolTipGenerator of variable toolTipGenerator does not match with type org.jfree.chart.labels.XYToolTipGenerator of variable generator |
2 | Unmatched statement tip=generator.generateToolTip(dataset,series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement tip=generator.generateToolTip(dataset,series,item); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
4 | Unmatched statement tip=toolTipGenerator.generateToolTip(dataset,key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |