366-1-2

if (allNull) { for (int item = 0, itemCount = this.rows.size(); item < itemCount; item++) { row = (KeyedObjects) this.rows.get(item); int colIndex = row.getIndex(columnKey); if (colIndex >= 0) { row.removeValue(colIndex); } } this.columnKeys.remove(columnKey); }
if (allNull) { for (int item = 0, itemCount = this.rows.size(); item < itemCount; item++) { row = (DefaultKeyedValues) this.rows.get(item); int columnIndex = row.getIndex(columnKey); if (columnIndex >= 0) { row.removeValue(columnIndex); } } this.columnKeys.remove(columnKey); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/KeyedObjects2D.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/DefaultKeyedValues2D.java
Method name: `void removeObject(Comparable, Comparable)` |  | Method name: `void removeValue(Comparable, Comparable)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    if (allNull) {↵

1

    if (allNull) {↵

2

                for (int item = 0, itemCount = this.rows.size(); item < itemCount; ↵

2

                for (int item = 0, itemCount = this.rows.size(); item < itemCount; ↵

3

                     item++) {↵

3

                     item++) {↵

4

                    row = (KeyedObjects) this.rows.get(item);↵

4

                    row = (DefaultKeyedValues) this.rows.get(item);↵

5

                    int colIndex = row.getIndex(columnKey);↵

5

                    int columnIndex = row.getIndex(columnKey);↵

6

                    if (colIndex >= 0) {↵

6

                    if (columnIndex >= 0) {↵

7

                        row.removeValue(colIndex);↵

7

                        row.removeValue(columnIndex);↵

8

                    }↵

8

                    }↵

9

                }↵

9

                }↵

10

                this.columnKeys.remove(columnKey);↵

10

                this.columnKeys.remove(columnKey);↵

11

            }

11

            }

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 | 18

1. {Non-refactorable}

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

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

   24

       if (allNull)

   19

       if (allNull)

   25

       for (int item = 0, itemCount = this.rows.size(); item < itemCount; item++)

   20

       for (int item = 0, itemCount = this.rows.size(); item < itemCount; item++)

   21 | row = (DefaultKeyedValues)this.rows.get(item);

   Preondition Violations
   Unmatched statement row=(DefaultKeyedValues)this.rows.get(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   21

       row = (DefaultKeyedValues)this.rows.get(item);

   26

       row = (KeyedObjects)this.rows.get(item);

   26 | row = (KeyedObjects)this.rows.get(item);

   Preondition Violations
   Unmatched statement row=(KeyedObjects)this.rows.get(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   27

       int colIndex = row.getIndex(columnKey);

   27 | int colIndex = row.getIndex(columnKey);
   22 | int columnIndex = row.getIndex(columnKey);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   colIndex | columnIndex | VARIABLE_NAME_MISMATCH
   org.jfree.data.KeyedObjects | org.jfree.data.DefaultKeyedValues | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.KeyedObjects of variable row does not match with type org.jfree.data.DefaultKeyedValues of variable row
   - Make classes org.jfree.data.KeyedObjects and org.jfree.data.DefaultKeyedValues extend a common superclass

   22

       int columnIndex = row.getIndex(columnKey);

   28

       if (colIndex >= 0)

   28 | if (colIndex >= 0)
   23 | if (columnIndex >= 0)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   colIndex | columnIndex | VARIABLE_NAME_MISMATCH

   23

       if (columnIndex >= 0)

   29

       row.removeValue(colIndex);

   29 | row.removeValue(colIndex);
   24 | row.removeValue(columnIndex);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   colIndex | columnIndex | VARIABLE_NAME_MISMATCH
   org.jfree.data.KeyedObjects | org.jfree.data.DefaultKeyedValues | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.KeyedObjects of variable row does not match with type org.jfree.data.DefaultKeyedValues of variable row
   - Make classes org.jfree.data.KeyedObjects and org.jfree.data.DefaultKeyedValues extend a common superclass

   24

       row.removeValue(columnIndex);

   30

       this.columnKeys.remove(columnKey);

   25

       this.columnKeys.remove(columnKey);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Unmatched statement row=(DefaultKeyedValues)this.rows.get(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement row=(KeyedObjects)this.rows.get(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Type org.jfree.data.KeyedObjects of variable row does not match with type org.jfree.data.DefaultKeyedValues of variable row
   4 | Type org.jfree.data.KeyedObjects of variable row does not match with type org.jfree.data.DefaultKeyedValues of variable row