400-3-5

if (this.cap != null) { this.cap.removeChangeListener(this); } this.cap = cap; if (cap != null) { cap.addChangeListener(this); } fireChangeEvent();
if (this.renderer != null) { this.renderer.removeChangeListener(this); } this.renderer = renderer; if (renderer != null) { renderer.setPlot(this); } fireChangeEvent();

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/WaferMapPlot.java
Method name: `void setCap(DialLayer)` |  | Method name: `void setRenderer(WaferMapRenderer)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (this.cap != null) {↵

1

    if (this.renderer != null) {↵

2

                this.cap.removeChangeListener(this);↵

2

                this.renderer.removeChangeListener(this);↵

3

            }↵

3

            }↵

4

            this.cap = cap;↵

4

            this.renderer = renderer;↵

5

            if (cap != null) {↵

5

            if (renderer != null) {↵

6

                cap.addChangeListener(this);↵

6

                renderer.setPlot(this);↵

7

            }↵

7

            }↵

8

            fireChangeEvent();

8

            fireChangeEvent();

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 17

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 0.8
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (this.cap != null)

   1 | if (this.cap != null)
   1 | if (this.renderer != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   cap | renderer | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.dial.DialLayer | org.jfree.chart.renderer.WaferMapRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.dial.DialLayer of variable this.cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable this.renderer
   - Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.renderer.WaferMapRenderer extend a common superclass

   1

       if (this.renderer != null)

   2

       this.cap.removeChangeListener(this);

   2 | this.cap.removeChangeListener(this);
   2 | this.renderer.removeChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   cap | renderer | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.dial.DialLayer | org.jfree.chart.renderer.WaferMapRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.dial.DialLayer of variable this.cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable this.renderer
   - Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.renderer.WaferMapRenderer extend a common superclass

   2

       this.renderer.removeChangeListener(this);

   3

       this.renderer = renderer;

   3

       this.cap = cap;

   4

       if (cap != null)

   4 | if (cap != null)
   4 | if (renderer != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   cap | renderer | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.dial.DialLayer | org.jfree.chart.renderer.WaferMapRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.dial.DialLayer of variable cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable renderer
   - Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.renderer.WaferMapRenderer extend a common superclass

   4

       if (renderer != null)

   5

       renderer.setPlot(this);

   5

       cap.addChangeListener(this);

   6

       fireChangeEvent();

   6

       fireChangeEvent();

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.plot.dial.DialLayer of variable this.cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable this.renderer
   2 | Type org.jfree.chart.plot.dial.DialLayer of variable this.cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable this.renderer
   3 | Type org.jfree.chart.plot.dial.DialLayer of variable cap does not match with type org.jfree.chart.renderer.WaferMapRenderer of variable renderer