if (info != null) { EntityCollection entities = info.getOwner().getEntityCollection(); if (entities != null) { String tip = null; PieToolTipGenerator tipster = getToolTipGenerator(); if (tipster != null) { // @mgs: using the method's return value was missing tip = tipster.generateToolTip(dataset, currentKey); } String url = null; if (getURLGenerator() != null) { url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex()); } PieSectionEntity entity = new PieSectionEntity( upperArc, dataset, getPieIndex(), sectionIndex, currentKey, tip, url); entities.add(entity); } }
EntityCollection entities = state.getEntityCollection(); if (entities != null && hotspot != null) { 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(hotspot, 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/PiePlot3D.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYAreaRenderer2.java
Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo) 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
if (info != null) {
2
                EntityCollection entities 
3
                        = info.getOwner().getEntityCollection();
1
EntityCollection entities = state.getEntityCollection();
4
                if (entities != null) {
2
            if (entities != null && hotspot != null) {
5
                    String tip = null;
3
                String tip = null;
6
                    PieToolTipGenerator tipster = getToolTipGenerator();
4
                XYToolTipGenerator generator = getToolTipGenerator(
7
                    if (tipster != null) {
5
                    
8
                        // @mgs: using the method's return value was missing 
9
    
6
series, item
7
                );
8
                if (generator != null) {
10
                    tip = tipster.generateToolTip(dataset, currentKey);
9
                    tip = generator.generateToolTip(dataset, series, item);
11
                    }
10
                }
12
                    String url = null;
11
                String url = null;
13
                    if (getURLGenerator() != null) {
12
                if (getURLGenerator() != null) {
14
                        url = getURLGenerator().generateURL(dataset, currentKey,
13
                    url = getURLGenerator().generateURL(dataset, 
15
                                getPieIndex());
16
    
14
series, item);
17
                }
15
                }
18
                    PieSectionEntity entity = new PieSectionEntity(
16
                XYItemEntity entity = new 
19
                            upperArc, dataset, getPieIndex(), sectionIndex, 
17
XYItemEntity(hotspot, dataset, 
20
                            currentKey, tip, url);
18
                        series, item, tip, url);
21
                    entities.add(entity);
19
                entities.add(entity);
22
                }
23
            }
20
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.7
Clones locationClones are in different classes
Number of node comparisons48
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)131.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                        
    58
    EntityCollection entities = state.getEntityCollection();
    197
    EntityCollection entities = info.getOwner().getEntityCollection();
    197
    EntityCollection entities = info.getOwner().getEntityCollection();
    Preondition Violations
    Unmatched statement EntityCollection entities=info.getOwner().getEntityCollection(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                              
    198
    if (entities != null)
    198
    if (entities != null)
    59
    if (entities != null && hotspot != null)
    Differences
    Expression1Expression2Difference
    !=&&OPERATOR_MISMATCH
    entitiesentities != nullINFIX_LEFT_OPERAND_MISMATCH
    nullhotspot != nullINFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression entities != null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entities != null && hotspot != null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    59
    if (entities != null && hotspot != null)
    199
    String tip = null;
    60
    String tip = null;
                                                                                                                                        
    61
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    200
    PieToolTipGenerator tipster = getToolTipGenerator();
    200
    PieToolTipGenerator tipster = getToolTipGenerator();
    Preondition Violations
    Unmatched statement PieToolTipGenerator tipster=getToolTipGenerator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    201
    if (tipster != null)
    201
    if (tipster != null)
    62
    if (generator != null)
    Differences
    Expression1Expression2Difference
    tipstergeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.PieToolTipGeneratororg.jfree.chart.labels.XYToolTipGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.PieToolTipGenerator of variable tipster does not match with type org.jfree.chart.labels.XYToolTipGenerator of variable generator
    • Make classes org.jfree.chart.labels.PieToolTipGenerator and org.jfree.chart.labels.XYToolTipGenerator extend a common superclass
    62
    if (generator != null)
                                                                                                                  
    63
    tip = generator.generateToolTip(dataset, series, item);
    Preondition Violations
    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
    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
    63
    tip = generator.generateToolTip(dataset, series, item);
    202
    tip = tipster.generateToolTip(dataset, currentKey);
    202
    tip = tipster.generateToolTip(dataset, currentKey);
    Preondition Violations
    Unmatched statement tip=tipster.generateToolTip(dataset,currentKey); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    203
    String url = null;
    64
    String url = null;
    204
    if (getURLGenerator() != null)
    204
    if (getURLGenerator() != null)
    65
    if (getURLGenerator() != null)
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.PieURLGeneratororg.jfree.chart.urls.XYURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.urls.PieURLGenerator of variable getURLGenerator() does not match with type org.jfree.chart.urls.XYURLGenerator of variable getURLGenerator()
    • Make classes org.jfree.chart.urls.PieURLGenerator and org.jfree.chart.urls.XYURLGenerator extend a common superclass
    65
    if (getURLGenerator() != null)
                                                                                                                          
    66
    url = getURLGenerator().generateURL(dataset, series, item);
    Preondition Violations
    Unmatched statement url=getURLGenerator().generateURL(dataset,series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    66
    url = getURLGenerator().generateURL(dataset, series, item);
    205
    url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex());
    205
    url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex());
    Preondition Violations
    Unmatched statement url=getURLGenerator().generateURL(dataset,currentKey,getPieIndex()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                      
    206
    PieSectionEntity entity = new PieSectionEntity(upperArc, dataset, getPieIndex(), sectionIndex, currentKey, tip, url);
    206
    PieSectionEntity entity = new PieSectionEntity(upperArc, dataset, getPieIndex(), sectionIndex, currentKey, tip, url);
    67
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item, tip, url);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.PieSectionEntityorg.jfree.chart.entity.XYItemEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.PieSectionEntityorg.jfree.chart.entity.XYItemEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.PieSectionEntityorg.jfree.chart.entity.XYItemEntitySUBCLASS_TYPE_MISMATCH
    new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url)new XYItemEntity(hotspot,dataset,series,item,tip,url)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYItemEntity(hotspot,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYItemEntity(hotspot,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    67
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item, tip, url);
                                                      
    68
    entities.add(entity);
    Preondition Violations
    Unmatched statement entities.add(entity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement entities.add(entity); 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
    68
    entities.add(entity);
    207
    entities.add(entity);
    207
    entities.add(entity);
    Preondition Violations
    Unmatched statement entities.add(entity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement entities.add(entity); 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
                                                        
    Precondition Violations (21)
    Row Violation
    1Unmatched statement EntityCollection entities=info.getOwner().getEntityCollection(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression entities != null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression entities != null && hotspot != null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement PieToolTipGenerator tipster=getToolTipGenerator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Type org.jfree.chart.labels.PieToolTipGenerator of variable tipster does not match with type org.jfree.chart.labels.XYToolTipGenerator of variable generator
    6Unmatched 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
    7Unmatched 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
    8Unmatched statement tip=tipster.generateToolTip(dataset,currentKey); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Type org.jfree.chart.urls.PieURLGenerator of variable getURLGenerator() does not match with type org.jfree.chart.urls.XYURLGenerator of variable getURLGenerator()
    10Unmatched statement url=getURLGenerator().generateURL(dataset,series,item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement url=getURLGenerator().generateURL(dataset,currentKey,getPieIndex()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Expression new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression new XYItemEntity(hotspot,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression new XYItemEntity(hotspot,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Unmatched statement entities.add(entity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Unmatched statement entities.add(entity); 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
    18Unmatched statement entities.add(entity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19Unmatched statement entities.add(entity); 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
    20Clone fragment #1 returns variables tip, url, entities, entity , while Clone fragment #2 returns variables tip, url, entities, entity
    21The refactoring of the clones is infeasible, because classes org.jfree.chart.plot.PiePlot3D and org.jfree.chart.renderer.xy.XYAreaRenderer2 do not have a common superclass