1754-1-2

if (this.extract == TableOrder.BY_ROW) { result = this.source.getValue(this.index, item); } else if (this.extract == TableOrder.BY_COLUMN) { result = this.source.getValue(item, this.index); }
if (this.extract == TableOrder.BY_ROW) { result = this.source.getValue(this.index, keyIndex); } else if (this.extract == TableOrder.BY_COLUMN) { result = this.source.getValue(keyIndex, this.index); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/category/CategoryToPieDataset.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/category/CategoryToPieDataset.java
Method name: `Number getValue(int)` |  | Method name: `Number getValue(Comparable)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    if (this.extract == TableOrder.BY_ROW) {↵

1

    if (this.extract == TableOrder.BY_ROW) {↵

2

                result = this.source.getValue(this.index, item);↵

2

                    result = this.source.getValue(this.index, keyIndex);↵

3

            }↵

3

                }↵

4

            else if (this.extract == TableOrder.BY_COLUMN) {↵

4

                else if (this.extract == TableOrder.BY_COLUMN) {↵

5

                result = this.source.getValue(item, this.index);↵

5

                    result = this.source.getValue(keyIndex, this.index);↵

6

            }

6

                }

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

1. {Refactorable}

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

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

   4

       if (this.extract == TableOrder.BY_ROW)

   4

       if (this.extract == TableOrder.BY_ROW)

   5

       result = this.source.getValue(this.index, item);

   5 | result = this.source.getValue(this.index, item);
   5 | result = this.source.getValue(this.index, keyIndex);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   item | keyIndex | VARIABLE_NAME_MISMATCH

   5

       result = this.source.getValue(this.index, keyIndex);

   6

       else if (this.extract == TableOrder.BY_COLUMN)

   6

       else if (this.extract == TableOrder.BY_COLUMN)

   7

       result = this.source.getValue(item, this.index);

   7 | result = this.source.getValue(item, this.index);
   7 | result = this.source.getValue(keyIndex, this.index);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   item | keyIndex | VARIABLE_NAME_MISMATCH

   7

       result = this.source.getValue(keyIndex, this.index);

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