425-2-3

ValueAxis existing = getDomainAxis(index); if (existing != null) { existing.removeChangeListener(this); } if (axis != null) { axis.setPlot(this); } this.domainAxes.set(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } 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/XYPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void setDomainAxis(int, ValueAxis, boolean)` |  | Method name: `void setRangeAxis(int, ValueAxis, boolean)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    ValueAxis existing = getDomainAxis(index);↵

1

    ValueAxis existing = getRangeAxis(index);↵

2

            if (existing != null) {↵

2

            if (existing != null) {↵

3

                existing.removeChangeListener(this);↵

3

                existing.removeChangeListener(this);↵

4

            }↵

4

            }↵

5

            if (axis != null) {↵

5

            if (axis != null) {↵

6

                axis.setPlot(this);↵

6

                axis.setPlot(this);↵

7

            }↵

7

            }↵

8

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

8

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

9

            if (axis != null) {↵

9

            if (axis != null) {↵

10

                axis.configure();↵

10

                axis.configure();↵

11

                axis.addChangeListener(this);↵

11

                axis.addChangeListener(this);↵

12

            }↵

12

            }↵

13

            if (notify) {↵

13

            if (notify) {↵

14

                fireChangeEvent();↵

14

                fireChangeEvent();↵

15

            }

15

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6
Clones location | Clones are declared in the same class
Number of node comparisons | 61

1. {Refactorable}

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

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

   1

       ValueAxis existing = getDomainAxis(index);

   1 | ValueAxis existing = getDomainAxis(index);
   1 | ValueAxis existing = getRangeAxis(index);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getDomainAxis | getRangeAxis | METHOD_INVOCATION_NAME_MISMATCH

   1

       ValueAxis existing = getRangeAxis(index);

   2

       if (existing != null)

   2

       if (existing != null)

   3

       existing.removeChangeListener(this);

   3

       existing.removeChangeListener(this);

   4

       if (axis != null)

   4

       if (axis != null)

   5

       axis.setPlot(this);

   5

       axis.setPlot(this);

   6

       this.domainAxes.set(index, axis);

   6 | this.domainAxes.set(index, axis);
   6 | this.rangeAxes.set(index, axis);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   domainAxes | rangeAxes | VARIABLE_NAME_MISMATCH

   6

       this.rangeAxes.set(index, axis);

   7

       if (axis != null)

   7

       if (axis != null)

   8

       axis.configure();

   8

       axis.configure();

   9

       axis.addChangeListener(this);

   9

       axis.addChangeListener(this);

   10

       if (notify)

   10

       if (notify)

   11

       fireChangeEvent();

   11

       fireChangeEvent();

   Precondition Violations (0)
   Row | Violation
   --- | ---