1561-1-2

DialLayer layer = (DialLayer) this.layers.get(index); if (layer != null) { layer.removeChangeListener(this); } this.layers.remove(index); fireChangeEvent();
DialPointer pointer = (DialPointer) this.pointers.get(index); if (pointer != null) { pointer.removeChangeListener(this); } this.pointers.remove(index); 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/dial/DialPlot.java
Method name: `void removeLayer(int)` |  | Method name: `void removePointer(int)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    DialLayer layer = (DialLayer) this.layers.get(index);↵

1

    DialPointer pointer = (DialPointer) this.pointers.get(index);↵

2

            if (layer != null) {↵

2

            if (pointer != null) {↵

3

                layer.removeChangeListener(this);↵

3

                pointer.removeChangeListener(this);↵

4

            }↵

4

            }↵

5

            this.layers.remove(index);↵

5

            this.pointers.remove(index);↵

6

            fireChangeEvent();

6

            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.1
Clones location | Clones are declared in the same class
Number of node comparisons | 13

1. {Non-refactorable}

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

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

   1

       DialPointer pointer = (DialPointer)this.pointers.get(index);

   1

       DialLayer layer = (DialLayer)this.layers.get(index);

   2

       if (layer != null)

   2 | if (layer != null)
   2 | if (pointer != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   layer | pointer | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.dial.DialLayer | org.jfree.chart.plot.dial.DialPointer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.dial.DialLayer of variable layer does not match with type org.jfree.chart.plot.dial.DialPointer of variable pointer
   - Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass

   2

       if (pointer != null)

   3

       layer.removeChangeListener(this);

   3 | layer.removeChangeListener(this);
   3 | pointer.removeChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   layer | pointer | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.dial.DialLayer | org.jfree.chart.plot.dial.DialPointer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.dial.DialLayer of variable layer does not match with type org.jfree.chart.plot.dial.DialPointer of variable pointer
   - Make classes org.jfree.chart.plot.dial.DialLayer and org.jfree.chart.plot.dial.DialPointer extend a common superclass

   3

       pointer.removeChangeListener(this);

   4

       this.layers.remove(index);

   4 | this.layers.remove(index);
   4 | this.pointers.remove(index);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   layers | pointers | VARIABLE_NAME_MISMATCH

   4

       this.pointers.remove(index);

   5

       fireChangeEvent();

   5

       fireChangeEvent();

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.plot.dial.DialLayer of variable layer does not match with type org.jfree.chart.plot.dial.DialPointer of variable pointer
   2 | Type org.jfree.chart.plot.dial.DialLayer of variable layer does not match with type org.jfree.chart.plot.dial.DialPointer of variable pointer