CategoryItemRenderer existing = (CategoryItemRenderer) this.renderers.get(index); if (existing != null) { existing.removeChangeListener(this); } // register the new renderer... this.renderers.set(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } configureDomainAxes(); configureRangeAxes(); if (notify) { fireChangeEvent(); }
ValueAxis existing = getRangeAxis(index); if (existing != null) { existing.removeChangeListener(this); } if (axis != null) { axis.setPlot(this); } this.rangeAxes.set(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } if (notify) { fireChangeEvent(); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: void setRenderer(int, CategoryItemRenderer, boolean) Method name: void setRangeAxis(int, ValueAxis, boolean)
Number of AST nodes: 11 Number of AST nodes: 11
1
CategoryItemRenderer existing
2
            = (CategoryItemRenderer) this.renderers.get(index);
1
ValueAxis existing = getRangeAxis(index);
3
        if (existing != null) {
2
        if (existing != null) {
4
            existing.removeChangeListener(this);
3
            existing.removeChangeListener(this);
5
        }
4
        }
6
        // register the new renderer...
5
        if (axis != null) {
6
            axis.setPlot(this);
7
        }
7
        this.renderers.set(index, renderer);
8
        this.rangeAxes.set(index, axis);
8
        if (renderer != null) {
9
        if (axis != null) {
9
            renderer.setPlot(this);
10
            axis.configure();
10
            renderer.addChangeListener(this);
11
            axis.addChangeListener(this);
11
        }
12
        }
12
        configureDomainAxes();
13
        configureRangeAxes();
14
        if (notify) {
13
        if (notify) {
15
            fireChangeEvent();
14
            fireChangeEvent();
16
        }
15
        }
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.8
Clones locationClones are in different classes having the same super class
Number of node comparisons47
  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)24.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                        
    1
    ValueAxis existing = getRangeAxis(index);
    1
    CategoryItemRenderer existing = (CategoryItemRenderer)this.renderers.get(index);
                                                                                                                                                                      
    2
    if (existing != null)
    2
    if (existing != null)
    2
    if (existing != null)
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.CategoryItemRendererorg.jfree.chart.axis.ValueAxisVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
    • Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass
    2
    if (existing != null)
    3
    existing.removeChangeListener(this);
    3
    existing.removeChangeListener(this);
    3
    existing.removeChangeListener(this);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.CategoryItemRendererorg.jfree.chart.axis.ValueAxisVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
    • Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass
    3
    existing.removeChangeListener(this);
    4
    this.renderers.set(index, renderer);
    4
    this.renderers.set(index, renderer);
    Preondition Violations
    Unmatched statement this.renderers.set(index,renderer); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                
    5
    if (renderer != null)
    5
    if (renderer != null)
    4
    if (axis != null)
    Differences
    Expression1Expression2Difference
    rendereraxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.category.CategoryItemRendererorg.jfree.chart.axis.ValueAxisVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
    • Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass
    4
    if (axis != null)
    6
    renderer.setPlot(this);
    6
    renderer.setPlot(this);
    5
    axis.setPlot(this);
    Differences
    Expression1Expression2Difference
    rendereraxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.category.CategoryItemRendererorg.jfree.chart.axis.ValueAxisVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
    • Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass
    5
    axis.setPlot(this);
    7
    renderer.addChangeListener(this);
    7
    renderer.addChangeListener(this);
    Preondition Violations
    Unmatched statement renderer.addChangeListener(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                            
                                                                        
    6
    this.rangeAxes.set(index, axis);
    Preondition Violations
    Unmatched statement this.rangeAxes.set(index,axis); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    this.rangeAxes.set(index, axis);
                                          
    7
    if (axis != null)
                                            
    8
    axis.configure();
                                                                    
    9
    axis.addChangeListener(this);
    Preondition Violations
    Unmatched statement axis.addChangeListener(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    axis.addChangeListener(this);
    8
    configureDomainAxes();
                                                      
    9
    configureRangeAxes();
                                                    
    10
    if (notify)
    10
    if (notify)
    11
    fireChangeEvent();
    11
    fireChangeEvent();
    Precondition Violations (8)
    Row Violation
    1Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
    2Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
    3Unmatched statement this.renderers.set(index,renderer); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
    5Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
    6Unmatched statement renderer.addChangeListener(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement this.rangeAxes.set(index,axis); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement axis.addChangeListener(this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted