1729-4-5

for (int i = 0; i < domainAxisCount; i++) { Axis axis = (Axis) this.domainAxes.get(i); if (axis != null) { axis.setPlot(this); axis.addChangeListener(this); } }
for (int i = 0; i < rangeAxisCount; i++) { Axis axis = (Axis) this.rangeAxes.get(i); if (axis != null) { axis.setPlot(this); axis.addChangeListener(this); } }

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 readObject(ObjectInputStream)` |  | Method name: `void readObject(ObjectInputStream)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    for (int i = 0; i < domainAxisCount; i++) {↵

1

    for (int i = 0; i < rangeAxisCount; i++) {↵

2

                Axis axis = (Axis) this.domainAxes.get(i);↵

2

                Axis axis = (Axis) this.rangeAxes.get(i);↵

3

                if (axis != null) {↵

3

                if (axis != null) {↵

4

                    axis.setPlot(this);↵

4

                    axis.setPlot(this);↵

5

                    axis.addChangeListener(this);↵

5

                    axis.addChangeListener(this);↵

6

                }↵

6

                }↵

7

            }

7

            }

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

1. {Refactorable}

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

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

   21

       for (int i = 0; i < domainAxisCount; i++)

   21 | for (int i = 0; i < domainAxisCount; i++)
   27 | for (int i = 0; i < rangeAxisCount; i++)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   domainAxisCount | rangeAxisCount | VARIABLE_NAME_MISMATCH

   27

       for (int i = 0; i < rangeAxisCount; i++)

   22

       Axis axis = (Axis)this.domainAxes.get(i);

   22 | Axis axis = (Axis)this.domainAxes.get(i);
   28 | Axis axis = (Axis)this.rangeAxes.get(i);

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

   28

       Axis axis = (Axis)this.rangeAxes.get(i);

   23

       if (axis != null)

   29

       if (axis != null)

   24

       axis.setPlot(this);

   30

       axis.setPlot(this);

   25

       axis.addChangeListener(this);

   31

       axis.addChangeListener(this);

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