178-2-5

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;
if (this.outlineStroke != null) { return this.outlineStroke; } // otherwise look up the stroke table Stroke result = getSeriesOutlineStroke(series); if (result == null && this.autoPopulateSeriesOutlineStroke) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { result = supplier.getNextOutlineStroke(); setSeriesOutlineStroke(series, result, false); } } if (result == null) { result = this.baseOutlineStroke; } return result;

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 lookupSeriesFillPaint(int)` |  | Method name: `Stroke lookupSeriesOutlineStroke(int)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    if (this.fillPaint != null) {↵

1

    if (this.outlineStroke != null) {↵

2

                return this.fillPaint;↵

2

                return this.outlineStroke;↵

3

            }↵

3

            }↵

4

            // otherwise look up the paint table↵

4

            // otherwise look up the stroke table↵

5

            Paint seriesFillPaint = getSeriesFillPaint(series);↵

5

            Stroke result = getSeriesOutlineStroke(series);↵

6

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

6

            if (result == null && this.autoPopulateSeriesOutlineStroke) {↵

7

                DrawingSupplier supplier = getDrawingSupplier();↵

7

                DrawingSupplier supplier = getDrawingSupplier();↵

8

                if (supplier != null) {↵

8

                if (supplier != null) {↵

9

                    seriesFillPaint = supplier.getNextFillPaint();↵

9

                    result = supplier.getNextOutlineStroke();↵

10

                    setSeriesFillPaint(series, seriesFillPaint, false);↵

10

                    setSeriesOutlineStroke(series, result, false);↵

11

                }↵

11

                }↵

12

            }↵

12

            }↵

13

            if (seriesFillPaint == null) {↵

13

            if (result == null) {↵

14

                seriesFillPaint = this.baseFillPaint;↵

14

                result = this.baseOutlineStroke;↵

15

            }↵

15

            }↵

16

            return seriesFillPaint;

16

            return result;

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 | 5
   Number of unmapped statements in the first code fragment | 6
   Number of unmapped statements in the second code fragment | 6
   Time elapsed for statement mapping (ms) | 1.9
   Clone type | Type 2

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

   1

       if (this.fillPaint != null)

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   fillPaint | outlineStroke | VARIABLE_NAME_MISMATCH
   java.awt.Paint | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Paint of variable this.fillPaint does not match with type java.awt.Stroke of variable this.outlineStroke
   - Make classes java.awt.Paint and java.awt.Stroke extend a common superclass

   1

       if (this.outlineStroke != null)

   2 | return this.outlineStroke;

   Preondition Violations
   Unmatched return this.outlineStroke;

   2

       return this.outlineStroke;

   2

       return this.fillPaint;

   2 | return this.fillPaint;

   Preondition Violations
   Unmatched return this.fillPaint;

   3

       Stroke result = getSeriesOutlineStroke(series);

   3

       Paint seriesFillPaint = getSeriesFillPaint(series);

   4

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

   4 | if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint)
   4 | if (result == null && this.autoPopulateSeriesOutlineStroke)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesFillPaint | result | VARIABLE_NAME_MISMATCH
   java.awt.Paint | java.awt.Stroke | VARIABLE_TYPE_MISMATCH
   autoPopulateSeriesFillPaint | autoPopulateSeriesOutlineStroke | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type java.awt.Paint of variable seriesFillPaint does not match with type java.awt.Stroke of variable result
   - Make classes java.awt.Paint and java.awt.Stroke extend a common superclass

   4

       if (result == null && this.autoPopulateSeriesOutlineStroke)

   5

       DrawingSupplier supplier = getDrawingSupplier();

   5

       DrawingSupplier supplier = getDrawingSupplier();

   6

       if (supplier != null)

   6

       if (supplier != null)

   7 | result = supplier.getNextOutlineStroke();

   Preondition Violations
   Unmatched statement result=supplier.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       result = supplier.getNextOutlineStroke();

   7

       seriesFillPaint = supplier.getNextFillPaint();

   7 | seriesFillPaint = supplier.getNextFillPaint();

   Preondition Violations
   Unmatched statement seriesFillPaint=supplier.getNextFillPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   8

       setSeriesOutlineStroke(series, result, false);

   8

       setSeriesFillPaint(series, seriesFillPaint, false);

   9

       if (seriesFillPaint == null)

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesFillPaint | result | VARIABLE_NAME_MISMATCH
   java.awt.Paint | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Paint of variable seriesFillPaint does not match with type java.awt.Stroke of variable result
   - Make classes java.awt.Paint and java.awt.Stroke extend a common superclass

   9

       if (result == null)

   10 | result = this.baseOutlineStroke;

   Preondition Violations
   Unmatched statement result=this.baseOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   10

       result = this.baseOutlineStroke;

   10

       seriesFillPaint = this.baseFillPaint;

   10 | seriesFillPaint = this.baseFillPaint;

   Preondition Violations
   Unmatched statement seriesFillPaint=this.baseFillPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   11 | return result;

   Preondition Violations
   Unmatched return result;

   11

       return result;

   11

       return seriesFillPaint;

   11 | return seriesFillPaint;

   Preondition Violations
   Unmatched return seriesFillPaint;

   Precondition Violations (11)
   Row | Violation
   --- | ---
   1 | Type java.awt.Paint of variable this.fillPaint does not match with type java.awt.Stroke of variable this.outlineStroke
   2 | Unmatched return this.outlineStroke;
   3 | Unmatched return this.fillPaint;
   4 | Type java.awt.Paint of variable seriesFillPaint does not match with type java.awt.Stroke of variable result
   5 | Unmatched statement result=supplier.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | Unmatched statement seriesFillPaint=supplier.getNextFillPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   7 | Type java.awt.Paint of variable seriesFillPaint does not match with type java.awt.Stroke of variable result
   8 | Unmatched statement result=this.baseOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   9 | Unmatched statement seriesFillPaint=this.baseFillPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   10 | Unmatched return result;
   11 | Unmatched return seriesFillPaint;