425-1-3

CategoryItemRenderer existing = (CategoryItemRenderer) this.renderers.get(index); if (existing != null) { existing.removeChangeListener(this); } // register the new renderer... this.renderers.set(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } configureDomainAxes(); configureRangeAxes(); if (notify) { fireChangeEvent(); }
ValueAxis existing = getRangeAxis(index); if (existing != null) { existing.removeChangeListener(this); } if (axis != null) { axis.setPlot(this); } this.rangeAxes.set(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } if (notify) { fireChangeEvent(); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void setRenderer(int, CategoryItemRenderer, boolean)` |  | Method name: `void setRangeAxis(int, ValueAxis, boolean)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    CategoryItemRenderer existing↵

2

                = (CategoryItemRenderer) this.renderers.get(index);↵

1

    ValueAxis existing = getRangeAxis(index);↵

3

            if (existing != null) {↵

2

            if (existing != null) {↵

4

                existing.removeChangeListener(this);↵

3

                existing.removeChangeListener(this);↵

5

            }↵

4

            }↵

6

            // register the new renderer...↵

5

            if (axis != null) {↵

6

                axis.setPlot(this);↵

7

            }↵

7

            this.renderers.set(index, renderer);↵

8

            this.rangeAxes.set(index, axis);↵

8

            if (renderer != null) {↵

9

            if (axis != null) {↵

9

                renderer.setPlot(this);↵

10

                axis.configure();↵

10

                renderer.addChangeListener(this);↵

11

                axis.addChangeListener(this);↵

11

            }↵

12

            }↵

12

            configureDomainAxes();↵

13

            configureRangeAxes();↵

14

            if (notify) {↵

13

            if (notify) {↵

15

                fireChangeEvent();↵

14

                fireChangeEvent();↵

16

            }

15

            }

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.5
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 42

1. {Non-refactorable}

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

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

   1

       ValueAxis existing = getRangeAxis(index);

   1

       CategoryItemRenderer existing = (CategoryItemRenderer)this.renderers.get(index);

   2

       if (existing != null)

   2 | if (existing != null)
   2 | if (existing != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.CategoryItemRenderer | org.jfree.chart.axis.ValueAxis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
   - Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass

   2

       if (existing != null)

   3

       existing.removeChangeListener(this);

   3 | existing.removeChangeListener(this);
   3 | existing.removeChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.CategoryItemRenderer | org.jfree.chart.axis.ValueAxis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
   - Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass

   3

       existing.removeChangeListener(this);

   4

       this.renderers.set(index, renderer);

   4 | this.renderers.set(index, renderer);
   6 | this.rangeAxes.set(index, axis);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   renderer | axis | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.category.CategoryItemRenderer | org.jfree.chart.axis.ValueAxis | VARIABLE_TYPE_MISMATCH
   renderers | rangeAxes | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
   - Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass

   6

       this.rangeAxes.set(index, axis);

   5

       if (renderer != null)

   5 | if (renderer != null)
   4 | if (axis != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   renderer | axis | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.category.CategoryItemRenderer | org.jfree.chart.axis.ValueAxis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
   - Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass

   4

       if (axis != null)

   6

       renderer.setPlot(this);

   6 | renderer.setPlot(this);
   5 | axis.setPlot(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   renderer | axis | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.category.CategoryItemRenderer | org.jfree.chart.axis.ValueAxis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
   - Make classes org.jfree.chart.renderer.category.CategoryItemRenderer and org.jfree.chart.axis.ValueAxis extend a common superclass

   5

       axis.setPlot(this);

   7

       renderer.addChangeListener(this);

   7

       if (axis != null)

   8

       axis.configure();

   9

       axis.addChangeListener(this);

   8

       configureDomainAxes();

   9

       configureRangeAxes();

   10

       if (notify)

   10

       if (notify)

   11

       fireChangeEvent();

   11

       fireChangeEvent();

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
   2 | Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable existing does not match with type org.jfree.chart.axis.ValueAxis of variable existing
   3 | Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
   4 | Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis
   5 | Type org.jfree.chart.renderer.category.CategoryItemRenderer of variable renderer does not match with type org.jfree.chart.axis.ValueAxis of variable axis