1462-1-2

if (greenForIncrease && newValue.doubleValue() > oldValue.doubleValue() || !greenForIncrease && newValue.doubleValue() < oldValue.doubleValue()) { plot.setSectionPaint(key, new Color(0, (int) shade, 0)); } else { plot.setSectionPaint(key, new Color((int) shade, 0, 0)); }
if (greenForIncrease && newValue.doubleValue() > oldValue.doubleValue() || !greenForIncrease && newValue.doubleValue() < oldValue.doubleValue()) { plot.setSectionPaint(key, new Color(0, (int) shade, 0)); } else { plot.setSectionPaint(key, new Color((int) shade, 0, 0)); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java
Method name: `JFreeChart createPieChart(String, PieDataset, PieDataset, int, boolean, boolean, boolean, Locale, boolean, boolean)` |  | Method name: `JFreeChart createPieChart(String, PieDataset, PieDataset, int, boolean, boolean, boolean, boolean, boolean, boolean)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (greenForIncrease ↵

1

    if (greenForIncrease ↵

2

                            && newValue.doubleValue() > oldValue.doubleValue()↵

2

                            && newValue.doubleValue() > oldValue.doubleValue()↵

3

                            || !greenForIncrease && newValue.doubleValue() ↵

3

                            || !greenForIncrease && newValue.doubleValue() ↵

4

                            < oldValue.doubleValue()) {↵

4

                            < oldValue.doubleValue()) {↵

5

                        plot.setSectionPaint(key, new Color(0, (int) shade, 0));↵

5

                        plot.setSectionPaint(key, new Color(0, (int) shade, 0));↵

6

                    }↵

6

                    }↵

7

                    else {↵

7

                    else {↵

8

                        plot.setSectionPaint(key, new Color((int) shade, 0, 0));↵

8

                        plot.setSectionPaint(key, new Color((int) shade, 0, 0));↵

9

                    }

9

                    }

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 3
   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) | 97.3
   Clone type | Type 1

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

   23

       if (greenForIncrease && newValue.doubleValue() > oldValue.doubleValue() || !greenForIncrease && newValue.doubleValue() < oldValue.doubleValue())

   25

       if (greenForIncrease && newValue.doubleValue() > oldValue.doubleValue() || !greenForIncrease && newValue.doubleValue() < oldValue.doubleValue())

   24

       plot.setSectionPaint(key, new Color(0, (int)shade, 0));

   26

       plot.setSectionPaint(key, new Color(0, (int)shade, 0));

       else

       else

   25

       plot.setSectionPaint(key, new Color((int)shade, 0, 0));

   27

       plot.setSectionPaint(key, new Color((int)shade, 0, 0));

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