ValueAxis axis = (ValueAxis) this.domainAxes.get(i); if (axis != null) { ValueAxis clonedAxis = (ValueAxis) axis.clone(); clone.domainAxes.set(i, clonedAxis); clonedAxis.setPlot(clone); clonedAxis.addChangeListener(clone); }
ValueAxis axis = (ValueAxis) this.rangeAxes.get(i); if (axis != null) { ValueAxis clonedAxis = (ValueAxis) axis.clone(); clone.rangeAxes.set(i, clonedAxis); clonedAxis.setPlot(clone); clonedAxis.addChangeListener(clone); }
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: Object clone() Method name: Object clone()
Number of AST nodes: 6 Number of AST nodes: 6
1
ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
1
ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
2
            if (axis != null) {
2
            if (axis != null) {
3
                ValueAxis clonedAxis = (ValueAxis) axis.clone();
3
                ValueAxis clonedAxis = (ValueAxis) axis.clone();
4
                clone.domainAxes.set(i, clonedAxis);
4
                clone.rangeAxes.set(i, clonedAxis);
5
                clonedAxis.setPlot(clone);
5
                clonedAxis.setPlot(clone);
6
                clonedAxis.addChangeListener(clone);
6
                clonedAxis.addChangeListener(clone);
7
            }
7
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in the same method
Number of node comparisons27
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)8.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    ValueAxis axis = (ValueAxis)this.domainAxes.get(i);
    4
    ValueAxis axis = (ValueAxis)this.domainAxes.get(i);
    13
    ValueAxis axis = (ValueAxis)this.rangeAxes.get(i);
    Differences
    Expression1Expression2Difference
    domainAxesrangeAxesVARIABLE_NAME_MISMATCH
    13
    ValueAxis axis = (ValueAxis)this.rangeAxes.get(i);
    5
    if (axis != null)
    14
    if (axis != null)
    6
    ValueAxis clonedAxis = (ValueAxis)axis.clone();
    15
    ValueAxis clonedAxis = (ValueAxis)axis.clone();
    7
    clone.domainAxes.set(i, clonedAxis);
    7
    clone.domainAxes.set(i, clonedAxis);
    16
    clone.rangeAxes.set(i, clonedAxis);
    Differences
    Expression1Expression2Difference
    domainAxesrangeAxesVARIABLE_NAME_MISMATCH
    16
    clone.rangeAxes.set(i, clonedAxis);
    8
    clonedAxis.setPlot(clone);
    17
    clonedAxis.setPlot(clone);
    9
    clonedAxis.addChangeListener(clone);
    18
    clonedAxis.addChangeListener(clone);
    Precondition Violations (0)
    Row Violation