362-1-2

if (axis != null) { axis.setPlot(this); axis.addChangeListener(this); } // plot is likely registered as a listener with the existing axis... if (this.rangeAxis != null) { this.rangeAxis.removeChangeListener(this); } this.rangeAxis = axis; fireChangeEvent();
if (isCompatibleDomainAxis(axis)) { if (axis != null) { axis.setPlot(this); axis.addChangeListener(this); } // plot is likely registered as a listener with the existing axis... if (this.domainAxis != null) { this.domainAxis.removeChangeListener(this); } this.domainAxis = axis; fireChangeEvent(); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ContourPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/ContourPlot.java
Method name: `void setRangeAxis(ValueAxis)` |  | Method name: `void setDomainAxis(ValueAxis)`
Number of AST nodes: 7 |  | Number of AST nodes: 8

1

    if (isCompatibleDomainAxis(axis)) {↵

1

    if (axis != null) {↵

2

                if (axis != null) {↵

2

                axis.setPlot(this);↵

3

                    axis.setPlot(this);↵

3

                axis.addChangeListener(this);↵

4

                    axis.addChangeListener(this);↵

4

            }↵

5

                }↵

5

            // plot is likely registered as a listener with the existing axis...↵

6

                // plot is likely registered as a listener with the existing axis...↵

6

            if (this.rangeAxis != null) {↵

7

                if (this.domainAxis != null) {↵

7

                this.rangeAxis.removeChangeListener(this);↵

8

                    this.domainAxis.removeChangeListener(this);↵

8

            }↵

9

                }↵

9

            this.rangeAxis = axis;↵

10

                this.domainAxis = axis;↵

10

            fireChangeEvent();

11

                fireChangeEvent();↵

12

            }

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 declared in the same class
Number of node comparisons | 22

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   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) | 1.2
   Clone type | Type 2

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

   1

       if (axis != null)

   2

       if (axis != null)

   2

       axis.setPlot(this);

   3

       axis.setPlot(this);

   3

       axis.addChangeListener(this);

   4

       axis.addChangeListener(this);

   4

       if (this.rangeAxis != null)

   4 | if (this.rangeAxis != null)
   5 | if (this.domainAxis != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   rangeAxis | domainAxis | VARIABLE_NAME_MISMATCH

   5

       if (this.domainAxis != null)

   5

       this.rangeAxis.removeChangeListener(this);

   5 | this.rangeAxis.removeChangeListener(this);
   6 | this.domainAxis.removeChangeListener(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   rangeAxis | domainAxis | VARIABLE_NAME_MISMATCH

   6

       this.domainAxis.removeChangeListener(this);

   6

       this.rangeAxis = axis;

   6 | this.rangeAxis = axis;
   7 | this.domainAxis = axis;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   rangeAxis | domainAxis | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression this.rangeAxis is a field being modified, and thus it cannot be parameterized
   Expression this.domainAxis is a field being modified, and thus it cannot be parameterized

   7

       this.domainAxis = axis;

   7

       fireChangeEvent();

   8

       fireChangeEvent();

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression this.rangeAxis is a field being modified, and thus it cannot be parameterized
   2 | Expression this.domainAxis is a field being modified, and thus it cannot be parameterized