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; }
if (drawHeight < this.minimumDrawHeight) { this.scaleY = (double) drawHeight / this.minimumDrawHeight; drawHeight = this.minimumDrawHeight; scale = true; } else if (drawHeight > this.maximumDrawHeight) { this.scaleY = (double) drawHeight / this.maximumDrawHeight; drawHeight = this.maximumDrawHeight; scale = true; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/ChartComposite.java File path: /jfreechart-1.0.10/swt/org/jfree/experimental/chart/swt/ChartComposite.java
Method name: void paintControl(PaintEvent) Method name: void paintControl(PaintEvent)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (drawWidth < this.minimumDrawWidth) {
1
if (drawHeight < this.minimumDrawHeight) {
2
            this.scaleX = (double) drawWidth / this.minimumDrawWidth;
2
            this.scaleY = (double) drawHeight / this.minimumDrawHeight;
3
            drawWidth = this.minimumDrawWidth;
3
            drawHeight = this.minimumDrawHeight;
4
            scale = true;
4
            scale = true;
5
        }
5
        }
6
        else if (drawWidth > this.maximumDrawWidth) {
6
        else if (drawHeight > this.maximumDrawHeight) {
7
            this.scaleX = (double) drawWidth / this.maximumDrawWidth;
7
            this.scaleY = (double) drawHeight / this.maximumDrawHeight;
8
            drawWidth = this.maximumDrawWidth;
8
            drawHeight = this.maximumDrawHeight;
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)0.5
Clones locationClones are in the same method
Number of node comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    if (drawWidth < this.minimumDrawWidth)
    13
    if (drawWidth < this.minimumDrawWidth)
    21
    if (drawHeight < this.minimumDrawHeight)
    Differences
    Expression1Expression2Difference
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    minimumDrawWidthminimumDrawHeightVARIABLE_NAME_MISMATCH
    21
    if (drawHeight < this.minimumDrawHeight)
    14
    this.scaleX = (double)drawWidth / this.minimumDrawWidth;
    14
    this.scaleX = (double)drawWidth / this.minimumDrawWidth;
    22
    this.scaleY = (double)drawHeight / this.minimumDrawHeight;
    Differences
    Expression1Expression2Difference
    scaleXscaleYVARIABLE_NAME_MISMATCH
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    minimumDrawWidthminimumDrawHeightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.scaleX is a field being modified, and thus it cannot be parameterized
    Expression this.scaleY is a field being modified, and thus it cannot be parameterized
    22
    this.scaleY = (double)drawHeight / this.minimumDrawHeight;
    15
    drawWidth = this.minimumDrawWidth;
    15
    drawWidth = this.minimumDrawWidth;
    23
    drawHeight = this.minimumDrawHeight;
    Differences
    Expression1Expression2Difference
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    minimumDrawWidthminimumDrawHeightVARIABLE_NAME_MISMATCH
    23
    drawHeight = this.minimumDrawHeight;
    16
    scale = true;
    24
    scale = true;
    17
    else if (drawWidth > this.maximumDrawWidth)
    17
    else if (drawWidth > this.maximumDrawWidth)
    25
    else if (drawHeight > this.maximumDrawHeight)
    Differences
    Expression1Expression2Difference
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    maximumDrawWidthmaximumDrawHeightVARIABLE_NAME_MISMATCH
    25
    else if (drawHeight > this.maximumDrawHeight)
    18
    this.scaleX = (double)drawWidth / this.maximumDrawWidth;
    18
    this.scaleX = (double)drawWidth / this.maximumDrawWidth;
    26
    this.scaleY = (double)drawHeight / this.maximumDrawHeight;
    Differences
    Expression1Expression2Difference
    scaleXscaleYVARIABLE_NAME_MISMATCH
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    maximumDrawWidthmaximumDrawHeightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.scaleX is a field being modified, and thus it cannot be parameterized
    Expression this.scaleY is a field being modified, and thus it cannot be parameterized
    26
    this.scaleY = (double)drawHeight / this.maximumDrawHeight;
    19
    drawWidth = this.maximumDrawWidth;
    19
    drawWidth = this.maximumDrawWidth;
    27
    drawHeight = this.maximumDrawHeight;
    Differences
    Expression1Expression2Difference
    drawWidthdrawHeightVARIABLE_NAME_MISMATCH
    maximumDrawWidthmaximumDrawHeightVARIABLE_NAME_MISMATCH
    27
    drawHeight = this.maximumDrawHeight;
    20
    scale = true;
    28
    scale = true;
    Precondition Violations (5)
    Row Violation
    1Expression this.scaleX is a field being modified, and thus it cannot be parameterized
    2Expression this.scaleY is a field being modified, and thus it cannot be parameterized
    3Expression this.scaleX is a field being modified, and thus it cannot be parameterized
    4Expression this.scaleY is a field being modified, and thus it cannot be parameterized
    5Clone fragment #1 returns variables scale, drawWidth , while Clone fragment #2 returns variables scale, drawHeight