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) { 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); }
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/plot/RingPlot.java
Method name: void draw(Graphics2D, Rectangle2D, Point2D, PlotState, PlotRenderingInfo) Method name: void drawItem(Graphics2D, int, Rectangle2D, PiePlotState, int)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (info != null) {
2
                EntityCollection entities 
3
                        = info.getOwner().getEntityCollection();
1
EntityCollection entities = state.getEntityCollection();
4
                if (entities != null) {
2
                    if (entities != null) {
5
                    String tip = null;
3
                        String tip = null;
6
                    PieToolTipGenerator tipster = getToolTipGenerator();
4
                        PieToolTipGenerator toolTipGenerator
5
 
7
                    if (tipster != null) {
6
                            
8
                        // @mgs: using the method's return value was missing 
7
    = getToolTipGenerator();
8
                        if (toolTipGenerator != null) {
9
                        tip = tipster.generateToolTip(dataset, currentK
9
                            tip = toolTipGenerator.generateToolTip(dataset, 
10
ey);
10
                                    key);
11
                    }
11
                    
12
    }
12
                    String url = null;
13
                        String url = null;
13
                    if (getURLGenerator()
14
                        PieURLGenerator urlGenerator = getURLGenerator();
14
 != null) {
15
                        if (urlGenerator != null) {
15
                        url = getURLGenerator().generateURL(dataset, currentKey,
16
                            url = urlGenerator.generateURL(dataset, key, 
16
                                getPieIndex());
17
                                    getPieIndex());
17
                    }
18
                    
19
    }
18
                    PieSectionEntity entity = new PieSectionEntity(
20
                        PieSectionEntity entity = new PieSectionEntity(path, 
19
                            upperArc, dataset, getPieIndex(), sectionIndex, 
21
                                dataset, getPieIndex(), section, key, tip, 
20
                            currentKey, tip, url);
22
                                url);
21
                    entities.add(entity);
23
                        entities.add(entity);
22
                }
24
        
23
            }
25
            }
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons57
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                        
    56
    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)
    57
    if (entities != null)
    199
    String tip = null;
    58
    String tip = null;
    200
    PieToolTipGenerator tipster = getToolTipGenerator();
    200
    PieToolTipGenerator tipster = getToolTipGenerator();
    59
    PieToolTipGenerator toolTipGenerator = getToolTipGenerator();
    Differences
    Expression1Expression2Difference
    tipstertoolTipGeneratorVARIABLE_NAME_MISMATCH
    59
    PieToolTipGenerator toolTipGenerator = getToolTipGenerator();
    201
    if (tipster != null)
    201
    if (tipster != null)
    60
    if (toolTipGenerator != null)
    Differences
    Expression1Expression2Difference
    tipstertoolTipGeneratorVARIABLE_NAME_MISMATCH
    60
    if (toolTipGenerator != null)
    202
    tip = tipster.generateToolTip(dataset, currentKey);
    202
    tip = tipster.generateToolTip(dataset, currentKey);
    61
    tip = toolTipGenerator.generateToolTip(dataset, key);
    Differences
    Expression1Expression2Difference
    currentKeykeyVARIABLE_NAME_MISMATCH
    tipstertoolTipGeneratorVARIABLE_NAME_MISMATCH
    61
    tip = toolTipGenerator.generateToolTip(dataset, key);
    203
    String url = null;
    62
    String url = null;
                                                                                                          
    63
    PieURLGenerator urlGenerator = getURLGenerator();
    204
    if (getURLGenerator() != null)
    204
    if (getURLGenerator() != null)
    64
    if (urlGenerator != null)
    Differences
    Expression1Expression2Difference
    getURLGenerator()urlGeneratorTYPE_COMPATIBLE_REPLACEMENT
    64
    if (urlGenerator != null)
    205
    url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex());
    205
    url = getURLGenerator().generateURL(dataset, currentKey, getPieIndex());
    65
    url = urlGenerator.generateURL(dataset, key, getPieIndex());
    Differences
    Expression1Expression2Difference
    currentKeykeyVARIABLE_NAME_MISMATCH
    getURLGenerator()urlGeneratorTYPE_COMPATIBLE_REPLACEMENT
    65
    url = urlGenerator.generateURL(dataset, key, getPieIndex());
                                                                                                                                                                                                      
    66
    PieSectionEntity entity = new PieSectionEntity(path, dataset, getPieIndex(), section, key, tip, url);
    Preondition Violations
    Unmatched statement PieSectionEntity entity=new PieSectionEntity(path,dataset,getPieIndex(),section,key,tip,url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    66
    PieSectionEntity entity = new PieSectionEntity(path, dataset, getPieIndex(), section, key, tip, url);
    206
    PieSectionEntity entity = new PieSectionEntity(upperArc, dataset, getPieIndex(), sectionIndex, currentKey, tip, url);
    206
    PieSectionEntity entity = new PieSectionEntity(upperArc, dataset, getPieIndex(), sectionIndex, currentKey, tip, url);
    Preondition Violations
    Unmatched statement PieSectionEntity entity=new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                        
    207
    entities.add(entity);
    67
    entities.add(entity);
    Precondition Violations (4)
    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 PieSectionEntity entity=new PieSectionEntity(path,dataset,getPieIndex(),section,key,tip,url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement PieSectionEntity entity=new PieSectionEntity(upperArc,dataset,getPieIndex(),sectionIndex,currentKey,tip,url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables tip, url , while Clone fragment #2 returns variables tip, url