178-1-2

if (this.paint != null) { return this.paint; } // otherwise look up the paint list Paint seriesPaint = getSeriesPaint(series); if (seriesPaint == null && this.autoPopulateSeriesPaint) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { seriesPaint = supplier.getNextPaint(); setSeriesPaint(series, seriesPaint, false); } } if (seriesPaint == null) { seriesPaint = this.basePaint; } return seriesPaint;
if (this.fillPaint != null) { return this.fillPaint; } // otherwise look up the paint table Paint seriesFillPaint = getSeriesFillPaint(series); if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { seriesFillPaint = supplier.getNextFillPaint(); setSeriesFillPaint(series, seriesFillPaint, false); } } if (seriesFillPaint == null) { seriesFillPaint = this.baseFillPaint; } return seriesFillPaint;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java
Method name: `Paint lookupSeriesPaint(int)` |  | Method name: `Paint lookupSeriesFillPaint(int)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    if (this.paint != null) {↵

1

    if (this.fillPaint != null) {↵

2

                return this.paint;↵

2

                return this.fillPaint;↵

3

            }↵

3

            }↵

4

            // otherwise look up the paint list↵

4

            // otherwise look up the paint table↵

5

            Paint seriesPaint = getSeriesPaint(series);↵

5

            Paint seriesFillPaint = getSeriesFillPaint(series);↵

6

            if (seriesPaint == null && this.autoPopulateSeriesPaint) {↵

6

            if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint) {↵

7

                DrawingSupplier supplier = getDrawingSupplier();↵

7

                DrawingSupplier supplier = getDrawingSupplier();↵

8

                if (supplier != null) {↵

8

                if (supplier != null) {↵

9

                    seriesPaint = supplier.getNextPaint();↵

9

                    seriesFillPaint = supplier.getNextFillPaint();↵

10

                    setSeriesPaint(series, seriesPaint, false);↵

10

                    setSeriesFillPaint(series, seriesFillPaint, false);↵

11

                }↵

11

                }↵

12

            }↵

12

            }↵

13

            if (seriesPaint == null) {↵

13

            if (seriesFillPaint == null) {↵

14

                seriesPaint = this.basePaint;↵

14

                seriesFillPaint = this.baseFillPaint;↵

15

            }↵

15

            }↵

16

            return seriesPaint;

16

            return seriesFillPaint;

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 11
   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.1
   Clone type | Type 2

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

   1

       if (this.paint != null)

   1 | if (this.paint != null)
   1 | if (this.fillPaint != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   paint | fillPaint | VARIABLE_NAME_MISMATCH

   1

       if (this.fillPaint != null)

   2

       return this.paint;

   2 | return this.paint;
   2 | return this.fillPaint;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   paint | fillPaint | VARIABLE_NAME_MISMATCH

   2

       return this.fillPaint;

   3

       Paint seriesPaint = getSeriesPaint(series);

   3 | Paint seriesPaint = getSeriesPaint(series);
   3 | Paint seriesFillPaint = getSeriesFillPaint(series);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH
   getSeriesPaint | getSeriesFillPaint | METHOD_INVOCATION_NAME_MISMATCH

   3

       Paint seriesFillPaint = getSeriesFillPaint(series);

   4

       if (seriesPaint == null && this.autoPopulateSeriesPaint)

   4 | if (seriesPaint == null && this.autoPopulateSeriesPaint)
   4 | if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH
   autoPopulateSeriesPaint | autoPopulateSeriesFillPaint | VARIABLE_NAME_MISMATCH

   4

       if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint)

   5

       DrawingSupplier supplier = getDrawingSupplier();

   5

       DrawingSupplier supplier = getDrawingSupplier();

   6

       if (supplier != null)

   6

       if (supplier != null)

   7

       seriesPaint = supplier.getNextPaint();

   7 | seriesPaint = supplier.getNextPaint();
   7 | seriesFillPaint = supplier.getNextFillPaint();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH
   getNextPaint | getNextFillPaint | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression supplier.getNextPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression supplier.getNextFillPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       seriesFillPaint = supplier.getNextFillPaint();

   8

       setSeriesPaint(series, seriesPaint, false);

   8 | setSeriesPaint(series, seriesPaint, false);
   8 | setSeriesFillPaint(series, seriesFillPaint, false);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setSeriesPaint | setSeriesFillPaint | METHOD_INVOCATION_NAME_MISMATCH
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression setSeriesPaint(series,seriesPaint,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression setSeriesFillPaint(series,seriesFillPaint,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression setSeriesPaint(series,seriesPaint,false) is a void method call, and thus it cannot be parameterized
   Expression setSeriesFillPaint(series,seriesFillPaint,false) is a void method call, and thus it cannot be parameterized

   8

       setSeriesFillPaint(series, seriesFillPaint, false);

   9

       if (seriesPaint == null)

   9 | if (seriesPaint == null)
   9 | if (seriesFillPaint == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH

   9

       if (seriesFillPaint == null)

   10

       seriesPaint = this.basePaint;

   10 | seriesPaint = this.basePaint;
   10 | seriesFillPaint = this.baseFillPaint;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH
   basePaint | baseFillPaint | VARIABLE_NAME_MISMATCH

   10

       seriesFillPaint = this.baseFillPaint;

   11

       return seriesPaint;

   11 | return seriesPaint;
   11 | return seriesFillPaint;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesPaint | seriesFillPaint | VARIABLE_NAME_MISMATCH

   11

       return seriesFillPaint;

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression supplier.getNextPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression supplier.getNextFillPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression setSeriesPaint(series,seriesPaint,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression setSeriesFillPaint(series,seriesFillPaint,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression setSeriesPaint(series,seriesPaint,false) is a void method call, and thus it cannot be parameterized
   6 | Expression setSeriesFillPaint(series,seriesFillPaint,false) is a void method call, and thus it cannot be parameterized