if (drawWidth < this.minimumDrawWidth) { this.scaleX = drawWidth / this.minimumDrawWidth; drawWidth = this.minimumDrawWidth; scale = true; } else if (drawWidth > this.maximumDrawWidth) { this.scaleX = drawWidth / this.maximumDrawWidth; drawWidth = this.maximumDrawWidth; scale = true; }
if (drawWidth < this.minimumDrawWidth) { this.scaleX = (double) drawWidth / this.minimumDrawWidth; drawWidth = this.minimumDrawWidth; scale = true; } else if (drawWidth > this.maximumDrawWidth) { this.scaleX = (double) drawWidth / this.maximumDrawWidth; drawWidth = this.maximumDrawWidth; scale = true; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartPanel.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/ChartComposite.java
Method name: void paintComponent(Graphics) Method name: void paintControl(PaintEvent)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (drawWidth < this.minimumDrawWidth) {
1
if (drawWidth < this.minimumDrawWidth) {
2
            this.scaleX = drawWidth / this.minimumDrawWidth;
2
            this.scaleX = (double) drawWidth / this.minimumDrawWidth;
3
            drawWidth = this.minimumDrawWidth;
3
            drawWidth = this.minimumDrawWidth;
4
            scale = true;
4
            scale = true;
5
        }
5
        }
6
        else if (drawWidth > this.maximumDrawWidth) {
6
        else if (drawWidth > this.maximumDrawWidth) {
7
            this.scaleX = drawWidth / this.maximumDrawWidth;
7
            this.scaleX = (double) drawWidth / this.maximumDrawWidth;
8
            drawWidth = this.maximumDrawWidth;
8
            drawWidth = this.maximumDrawWidth;
9
            scale = true;
9
            scale = true;
10
        }
10
        }
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)1.5
Clones locationClones are in different classes
Number of node comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)9.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    if (drawWidth < this.minimumDrawWidth)
    13
    if (drawWidth < this.minimumDrawWidth)
    13
    if (drawWidth < this.minimumDrawWidth)
    Differences
    Expression1Expression2Difference
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable drawWidth does not match with type int of variable drawWidth
    13
    if (drawWidth < this.minimumDrawWidth)
    14
    this.scaleX = drawWidth / this.minimumDrawWidth;
    14
    this.scaleX = drawWidth / this.minimumDrawWidth;
    14
    this.scaleX = (double)drawWidth / this.minimumDrawWidth;
    Differences
    Expression1Expression2Difference
    drawWidth(double)drawWidthTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (double)drawWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    this.scaleX = (double)drawWidth / this.minimumDrawWidth;
                                                                            
    15
    drawWidth = this.minimumDrawWidth;
    Preondition Violations
    Unmatched statement drawWidth=this.minimumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    drawWidth = this.minimumDrawWidth;
    15
    drawWidth = this.minimumDrawWidth;
    15
    drawWidth = this.minimumDrawWidth;
    Preondition Violations
    Unmatched statement drawWidth=this.minimumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    16
    scale = true;
    16
    scale = true;
    17
    else if (drawWidth > this.maximumDrawWidth)
    17
    else if (drawWidth > this.maximumDrawWidth)
    17
    else if (drawWidth > this.maximumDrawWidth)
    Differences
    Expression1Expression2Difference
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable drawWidth does not match with type int of variable drawWidth
    17
    else if (drawWidth > this.maximumDrawWidth)
    18
    this.scaleX = drawWidth / this.maximumDrawWidth;
    18
    this.scaleX = drawWidth / this.maximumDrawWidth;
    18
    this.scaleX = (double)drawWidth / this.maximumDrawWidth;
    Differences
    Expression1Expression2Difference
    drawWidth(double)drawWidthTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (double)drawWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    this.scaleX = (double)drawWidth / this.maximumDrawWidth;
                                                                            
    19
    drawWidth = this.maximumDrawWidth;
    Preondition Violations
    Unmatched statement drawWidth=this.maximumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    drawWidth = this.maximumDrawWidth;
    19
    drawWidth = this.maximumDrawWidth;
    19
    drawWidth = this.maximumDrawWidth;
    Preondition Violations
    Unmatched statement drawWidth=this.maximumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    20
    scale = true;
    20
    scale = true;
    Precondition Violations (9)
    Row Violation
    1Type double of variable drawWidth does not match with type int of variable drawWidth
    2Expression (double)drawWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement drawWidth=this.minimumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement drawWidth=this.minimumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Type double of variable drawWidth does not match with type int of variable drawWidth
    6Expression (double)drawWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement drawWidth=this.maximumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement drawWidth=this.maximumDrawWidth; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9The refactoring of the clones is infeasible, because classes org.jfree.chart.ChartPanel and org.jfree.experimental.chart.swt.ChartComposite do not have a common superclass