253-1-2

for (int r = 0; r < this.dataset.getRowCount(); r++) { Comparable key = this.dataset.getRowKey(r); Paint p = piePlot.getSectionPaint(key); if (p == null) { p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint(); } } this.sectionPaints.put(key, p); }
for (int c = 0; c < this.dataset.getColumnCount(); c++) { Comparable key = this.dataset.getColumnKey(c); Paint p = piePlot.getSectionPaint(key); if (p == null) { p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint(); } } this.sectionPaints.put(key, p); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/MultiplePiePlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/MultiplePiePlot.java
Method name: `void prefetchSectionPaints()` |  | Method name: `void prefetchSectionPaints()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    for (int r = 0; r < this.dataset.getRowCount(); r++) {↵

1

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

2

                    Comparable key = this.dataset.getRowKey(r);↵

2

                    Comparable key = this.dataset.getColumnKey(c);↵

3

                    Paint p = piePlot.getSectionPaint(key);↵

3

                    Paint p = piePlot.getSectionPaint(key);↵

4

                    if (p == null) {↵

4

                    if (p == null) {↵

5

                        p = (Paint) this.sectionPaints.get(key);↵

5

                        p = (Paint) this.sectionPaints.get(key);↵

6

                        if (p == null) {↵

6

                        if (p == null) {↵

7

                            p = getDrawingSupplier().getNextPaint();↵

7

                            p = getDrawingSupplier().getNextPaint();↵

8

                        }↵

8

                        }↵

9

                    }↵

9

                    }↵

10

                    this.sectionPaints.put(key, p);↵

10

                    this.sectionPaints.put(key, p);↵

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 the same method
Number of node comparisons | 24

1. {Non-refactorable}

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

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

   11

       for (int r = 0; r < this.dataset.getRowCount(); r++)

   11 | for (int r = 0; r < this.dataset.getRowCount(); r++)
   3 | for (int c = 0; c < this.dataset.getColumnCount(); c++)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r | c | VARIABLE_NAME_MISMATCH
   r | c | VARIABLE_NAME_MISMATCH
   getRowCount | getColumnCount | METHOD_INVOCATION_NAME_MISMATCH
   r | c | VARIABLE_NAME_MISMATCH

   3

       for (int c = 0; c < this.dataset.getColumnCount(); c++)

   12

       Comparable key = this.dataset.getRowKey(r);

   12 | Comparable key = this.dataset.getRowKey(r);
   4 | Comparable key = this.dataset.getColumnKey(c);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getRowKey | getColumnKey | METHOD_INVOCATION_NAME_MISMATCH
   r | c | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression this.dataset.getRowKey(r) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression this.dataset.getColumnKey(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       Comparable key = this.dataset.getColumnKey(c);

   13

       Paint p = piePlot.getSectionPaint(key);

   5

       Paint p = piePlot.getSectionPaint(key);

   14

       if (p == null)

   6

       if (p == null)

   15

       p = (Paint)this.sectionPaints.get(key);

   7

       p = (Paint)this.sectionPaints.get(key);

   16

       if (p == null)

   8

       if (p == null)

   17

       p = getDrawingSupplier().getNextPaint();

   9

       p = getDrawingSupplier().getNextPaint();

   18

       this.sectionPaints.put(key, p);

   10

       this.sectionPaints.put(key, p);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression this.dataset.getRowKey(r) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression this.dataset.getColumnKey(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted