1820-4-5

for (int i = 0; i < this.rangeAxes.size(); i++) { ValueAxis axis = (ValueAxis) this.rangeAxes.get(i); if (axis != null) { axis.removeChangeListener(this); } }
for (int c = 0; c < this.data.getColumnCount(); c++) { Number value = this.data.getValue(r, c); if (value != null) { unique.add(value); } }

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/data/general/WaferMapDataset.java
Method name: `void clearRangeAxes()` |  | Method name: `Set getUniqueValues()`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    for (int i = 0; i < this.rangeAxes.size(); i++) {↵

1

    for (int c = 0; c < this.data.getColumnCount(); c++) {↵

2

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

2

                    ↵

3

    Number value = this.data.getValue(r, c);↵

3

                if (axis != null) {↵

4

                    if (value != null) {↵

4

                    axis.removeChangeListener(this);↵

5

                        unique.add(value);↵

5

                }↵

6

                ↵

7

        }↵

6

            }

8

                }

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 in different classes
Number of node comparisons | 6

1. {Non-refactorable}

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

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

   2

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

   2 | ValueAxis axis = (ValueAxis)this.rangeAxes.get(i);

   Preondition Violations
   Unmatched statement ValueAxis axis=(ValueAxis)this.rangeAxes.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4 | Number value = this.data.getValue(r, c);

   Preondition Violations
   Unmatched statement Number value=this.data.getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       Number value = this.data.getValue(r, c);

   3

       if (axis != null)

   3 | if (axis != null)
   5 | if (value != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   axis | value | VARIABLE_NAME_MISMATCH
   org.jfree.chart.axis.ValueAxis | java.lang.Number | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.axis.ValueAxis of variable axis does not match with type java.lang.Number of variable value
   - Make classes org.jfree.chart.axis.ValueAxis and java.lang.Number extend a common superclass

   5

       if (value != null)

   4

       axis.removeChangeListener(this);

   6

       unique.add(value);

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Unmatched statement ValueAxis axis=(ValueAxis)this.rangeAxes.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement Number value=this.data.getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Type org.jfree.chart.axis.ValueAxis of variable axis does not match with type java.lang.Number of variable value