if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged();
if (this.background != null) { this.background.removeChangeListener(this); } this.background = background; if (background != null) { background.addChangeListener(this); } fireChangeEvent();
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPlot.java
Method name: void setTitle(TextTitle) Method name: void setBackground(DialLayer)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (this.title != null) {
1
if (this.background != null) {
2
            this.title.removeChangeListener(this);
2
            this.background.removeChangeListener(this);
3
        }
3
        }
4
        this.title = title;
4
        this.background = background;
5
        if (title != null) {
5
        if (background != null) {
6
            title.addChangeListener(this);
6
            background.addChangeListener(this);
7
        }
7
        }
8
        fireChartChanged();
8
        fireChangeEvent();
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.6
Clones locationClones are in different classes
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)20.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.title != null)
    1
    if (this.title != null)
    1
    if (this.background != null)
    Differences
    Expression1Expression2Difference
    titlebackgroundVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.TextTitleorg.jfree.chart.plot.dial.DialLayerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.title.TextTitle of variable this.title does not match with type org.jfree.chart.plot.dial.DialLayer of variable this.background
    • Make classes org.jfree.chart.title.TextTitle and org.jfree.chart.plot.dial.DialLayer extend a common superclass
    1
    if (this.background != null)
    2
    this.title.removeChangeListener(this);
    2
    this.title.removeChangeListener(this);
    2
    this.background.removeChangeListener(this);
    Differences
    Expression1Expression2Difference
    titlebackgroundVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.TextTitleorg.jfree.chart.plot.dial.DialLayerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.title.TextTitle of variable this.title does not match with type org.jfree.chart.plot.dial.DialLayer of variable this.background
    • Make classes org.jfree.chart.title.TextTitle and org.jfree.chart.plot.dial.DialLayer extend a common superclass
    2
    this.background.removeChangeListener(this);
                                                                
    3
    this.background = background;
    Preondition Violations
    Unmatched statement this.background=background; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    this.background = background;
    3
    this.title = title;
    3
    this.title = title;
    Preondition Violations
    Unmatched statement this.title=title; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                            
    4
    if (title != null)
    4
    if (title != null)
    4
    if (background != null)
    Differences
    Expression1Expression2Difference
    titlebackgroundVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.TextTitleorg.jfree.chart.plot.dial.DialLayerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.title.TextTitle of variable title does not match with type org.jfree.chart.plot.dial.DialLayer of variable background
    • Make classes org.jfree.chart.title.TextTitle and org.jfree.chart.plot.dial.DialLayer extend a common superclass
    4
    if (background != null)
    5
    title.addChangeListener(this);
    5
    title.addChangeListener(this);
    5
    background.addChangeListener(this);
    Differences
    Expression1Expression2Difference
    titlebackgroundVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.TextTitleorg.jfree.chart.plot.dial.DialLayerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.title.TextTitle of variable title does not match with type org.jfree.chart.plot.dial.DialLayer of variable background
    • Make classes org.jfree.chart.title.TextTitle and org.jfree.chart.plot.dial.DialLayer extend a common superclass
    5
    background.addChangeListener(this);
    6
    fireChartChanged();
    6
    fireChartChanged();
    6
    fireChangeEvent();
    Differences
    Expression1Expression2Difference
    fireChartChangedfireChangeEventMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression fireChartChanged() is a void method call, and thus it cannot be parameterized
    Expression fireChangeEvent() is a void method call, and thus it cannot be parameterized
    6
    fireChangeEvent();
    Precondition Violations (9)
    Row Violation
    1Type org.jfree.chart.title.TextTitle of variable this.title does not match with type org.jfree.chart.plot.dial.DialLayer of variable this.background
    2Type org.jfree.chart.title.TextTitle of variable this.title does not match with type org.jfree.chart.plot.dial.DialLayer of variable this.background
    3Unmatched statement this.background=background; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement this.title=title; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Type org.jfree.chart.title.TextTitle of variable title does not match with type org.jfree.chart.plot.dial.DialLayer of variable background
    6Type org.jfree.chart.title.TextTitle of variable title does not match with type org.jfree.chart.plot.dial.DialLayer of variable background
    7Expression fireChartChanged() is a void method call, and thus it cannot be parameterized
    8Expression fireChangeEvent() is a void method call, and thus it cannot be parameterized
    9The refactoring of the clones is infeasible, because classes org.jfree.chart.JFreeChart and org.jfree.chart.plot.dial.DialPlot do not have a common superclass