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); }
if (entities != 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(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/PiePlot3D.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/HighLowRenderer.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: 11 Number of AST nodes: 10
1
EntityCollection entities 
2
                        = info.getOwner().getEntityCollection();
3
                if (entities != null) {
1
if (entities != null) {
4
                    String tip = null;
2
            String tip = null;
5
                    PieToolTipGenerator tipster = getToolTipGenerator();
3
            XYToolTipGenerator generator = getToolTipGenerator(
6
        
4
series, item);
7
            if (tipster != null) {
5
            if (generator != null) {
8
                        // @mgs: using the method's return value was missing 
6
                
9
                        tip = tipster.generateToolTip(dataset, currentKey);
7
tip = generator.generateToolTip(dataset, 
10
     
8
series, item);
11
               }
9
            
12
     
10
}
13
               String url = null;
11
            String url = null;
14
                    if (getURLGenerator() != null) {
12
            if (getURLGenerator() != null) {
15
                        url = getURLGenerator().generateURL(dataset, currentKey,
13
                url = getURLGenerator().generateURL(dataset, 
16
                                getPieIndex());
17
      
14
series, item);
18
              }
15
            }
19
                    PieSectionEntity entity = new PieSectionEntity(
16
            XYItemEntity entity = new 
20
                            upperArc, dataset, getPieIndex(), sectionIndex, 
21
     
17
XYItemEntity(entityArea, dataset,
22
                       currentKey, tip, url);
18
                    series, item, tip, url);
23
                    entities.add(entity);
19
            entities.add(entity);
24
                }
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.4
Clones locationClones are in different classes
Number of node comparisons46
  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 fragment4
    Time elapsed for statement mapping (ms)130.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    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)
    66
    if (entities != null)
    199
    String tip = null;
    67
    String tip = null;
                                                                                                                                        
    68
    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)
    69
    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
    69
    if (generator != null)
                                                                                                                  
    70
    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
    70
    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;
    71
    String url = null;
    204
    if (getURLGenerator() != null)
    204
    if (getURLGenerator() != null)
    72
    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
    72
    if (getURLGenerator() != null)
                                                                                                                          
    73
    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
    73
    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);
    74
    XYItemEntity entity = new XYItemEntity(entityArea, 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(entityArea,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(entityArea,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(entityArea,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    74
    XYItemEntity entity = new XYItemEntity(entityArea, dataset, series, item, tip, url);
                                                      
    75
    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
    75
    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 (19)
    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
    2Unmatched statement PieToolTipGenerator tipster=getToolTipGenerator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.jfree.chart.labels.PieToolTipGenerator of variable tipster does not match with type org.jfree.chart.labels.XYToolTipGenerator of variable generator
    4Unmatched 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
    5Unmatched 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
    6Unmatched 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
    7Type org.jfree.chart.urls.PieURLGenerator of variable getURLGenerator() does not match with type org.jfree.chart.urls.XYURLGenerator of variable getURLGenerator()
    8Unmatched 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
    9Unmatched 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
    10Expression new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression new XYItemEntity(entityArea,dataset,series,item,tip,url) cannot be parameterized, 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(entityArea,dataset,series,item,tip,url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Unmatched statement entities.add(entity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Unmatched 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
    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
    18Clone fragment #1 returns variables tip, url, entity , while Clone fragment #2 returns variables tip, url, entity
    19The refactoring of the clones is infeasible, because classes org.jfree.chart.plot.PiePlot3D and org.jfree.chart.renderer.xy.HighLowRenderer do not have a common superclass