if (stroke == null) { if (this.outlineStroke != null) { this.outlineStroke = null; fireChangeEvent(); } } else { if (this.outlineStroke != null) { if (this.outlineStroke.equals(stroke)) { return; // nothing to do } } this.outlineStroke = stroke; fireChangeEvent(); }
if (paint == null) { if (this.outlinePaint != null) { this.outlinePaint = null; fireChangeEvent(); } } else { if (this.outlinePaint != null) { if (this.outlinePaint.equals(paint)) { return; // nothing to do } } this.outlinePaint = paint; fireChangeEvent(); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java
Method name: void setOutlineStroke(Stroke) Method name: void setOutlinePaint(Paint)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (stroke == null) {
1
if (paint == null) {
2
            if (this.outlineStroke != null) {
2
            if (this.outlinePaint != null) {
3
                this.outlineStroke = null;
3
                this.outlinePaint = null;
4
                fireChangeEvent();
4
                fireChangeEvent();
5
            }
5
            }
6
        }
6
        }
7
        else {
7
        else {
8
            if (this.outlineStroke != null) {
8
            if (this.outlinePaint != null) {
9
                if (this.outlineStroke.equals(stroke)) {
9
                if (this.outlinePaint.equals(paint)) {
10
                    return;  // nothing to do
10
                    return;  // nothing to do
11
                }
11
                }
12
            }
12
            }
13
            this.outlineStroke = stroke;
13
            this.outlinePaint = paint;
14
            fireChangeEvent();
14
            fireChangeEvent();
15
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (stroke == null)
    1
    if (stroke == null)
    1
    if (paint == null)
    Differences
    Expression1Expression2Difference
    strokepaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable stroke does not match with type java.awt.Paint of variable paint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    1
    if (paint == null)
    2
    if (this.outlineStroke != null)
    2
    if (this.outlineStroke != null)
    2
    if (this.outlinePaint != null)
    Differences
    Expression1Expression2Difference
    outlineStrokeoutlinePaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    2
    if (this.outlinePaint != null)
                                                        
    3
    this.outlinePaint = null;
    Preondition Violations
    Unmatched statement this.outlinePaint=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    this.outlinePaint = null;
    3
    this.outlineStroke = null;
    3
    this.outlineStroke = null;
    Preondition Violations
    Unmatched statement this.outlineStroke=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                          
    4
    fireChangeEvent();
    4
    fireChangeEvent();
    else
    else
    5
    if (this.outlineStroke != null)
    5
    if (this.outlineStroke != null)
    5
    if (this.outlinePaint != null)
    Differences
    Expression1Expression2Difference
    outlineStrokeoutlinePaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    5
    if (this.outlinePaint != null)
    6
    if (this.outlineStroke.equals(stroke))
    6
    if (this.outlineStroke.equals(stroke))
    6
    if (this.outlinePaint.equals(paint))
    Differences
    Expression1Expression2Difference
    strokepaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    outlineStrokeoutlinePaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable stroke does not match with type java.awt.Paint of variable paint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    6
    if (this.outlinePaint.equals(paint))
    7
    return;
    7
    return;
                                                          
    8
    this.outlinePaint = paint;
    Preondition Violations
    Unmatched statement this.outlinePaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    this.outlinePaint = paint;
    8
    this.outlineStroke = stroke;
    8
    this.outlineStroke = stroke;
    Preondition Violations
    Unmatched statement this.outlineStroke=stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                              
    9
    fireChangeEvent();
    9
    fireChangeEvent();
    Precondition Violations (9)
    Row Violation
    1Type java.awt.Stroke of variable stroke does not match with type java.awt.Paint of variable paint
    2Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    3Unmatched statement this.outlinePaint=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement this.outlineStroke=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    6Type java.awt.Stroke of variable stroke does not match with type java.awt.Paint of variable paint
    7Type java.awt.Stroke of variable this.outlineStroke does not match with type java.awt.Paint of variable this.outlinePaint
    8Unmatched statement this.outlinePaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement this.outlineStroke=stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted