253-1-2

if (xQ1 != null && xQ3 != null && xMax != null && xMin != null) { double xxQ1 = rangeAxis.valueToJava2D(xQ1.doubleValue(), dataArea, location); double xxQ3 = rangeAxis.valueToJava2D(xQ3.doubleValue(), dataArea, location); double xxMax = rangeAxis.valueToJava2D(xMax.doubleValue(), dataArea, location); double xxMin = rangeAxis.valueToJava2D(xMin.doubleValue(), dataArea, location); double yymid = yy + state.getBarWidth() / 2.0; // draw the upper shadow... g2.draw(new Line2D.Double(xxMax, yymid, xxQ3, yymid)); g2.draw(new Line2D.Double(xxMax, yy, xxMax, yy + state.getBarWidth())); // draw the lower shadow... g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid)); g2.draw(new Line2D.Double(xxMin, yy, xxMin, yy + state.getBarWidth())); // draw the box... box = new Rectangle2D.Double(Math.min(xxQ1, xxQ3), yy, Math.abs(xxQ1 - xxQ3), state.getBarWidth()); if (this.fillBox) { g2.fill(box); } g2.setStroke(getItemOutlineStroke(row, column)); g2.setPaint(getItemOutlinePaint(row, column)); g2.draw(box); }
if (yQ1 != null && yQ3 != null && yMax != null && yMin != null) { double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea, location); double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea, location); double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(), dataArea, location); double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(), dataArea, location); double xxmid = xx + state.getBarWidth() / 2.0; // draw the upper shadow... g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3)); g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(), yyMax)); // draw the lower shadow... g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1)); g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(), yyMin)); // draw the body... box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3), state.getBarWidth(), Math.abs(yyQ1 - yyQ3)); if (this.fillBox) { g2.fill(box); } g2.setStroke(getItemOutlineStroke(row, column)); g2.setPaint(getItemOutlinePaint(row, column)); g2.draw(box); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java
Method name: `void drawHorizontalItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int)` |  | Method name: `void drawVerticalItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int)`
Number of AST nodes: 16 |  | Number of AST nodes: 16

1

    if (xQ1 != null && xQ3 != null && xMax != null && xMin != null) {↵

1

    if (yQ1 != null && yQ3 != null && yMax != null && yMin != null) {↵

2

                double xxQ1 = rangeAxis.valueToJava2D(xQ1.doubleValue(), dataArea,↵

2

                double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea,↵

3

                        location);↵

3

                        location);↵

4

                double xxQ3 = rangeAxis.valueToJava2D(xQ3.doubleValue(), dataArea,↵

4

                double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea,↵

5

                        location);↵

5

                        location);↵

6

                double xxMax = rangeAxis.valueToJava2D(xMax.doubleValue(), dataArea,↵

6

                double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(),↵

7

                        location);↵

7

                        dataArea, location);↵

8

                double xxMin = rangeAxis.valueToJava2D(xMin.doubleValue(), dataArea,↵

8

                double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(),↵

9

                        location);↵

9

                        dataArea, location);↵

10

                double yymid = yy + state.getBarWidth() / 2.0;↵

10

                double xxmid = xx + state.getBarWidth() / 2.0;↵

11

                // draw the upper shadow...↵

11

                // draw the upper shadow...↵

12

                g2.draw(new Line2D.Double(xxMax, yymid, xxQ3, yymid));↵

12

                g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3));↵

13

                g2.draw(new Line2D.Double(xxMax, yy, xxMax,↵

13

                g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(),↵

14

                        yy + state.getBarWidth()));↵

14

                        yyMax));↵

15

                // draw the lower shadow...↵

15

                // draw the lower shadow...↵

16

                g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid));↵

16

                g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1));↵

17

                g2.draw(new Line2D.Double(xxMin, yy, xxMin,↵

17

                g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(),↵

18

                        yy + state.getBarWidth()));↵

18

                        yyMin));↵

19

                // draw the box...↵

19

                // draw the body...↵

20

                box = new Rectangle2D.Double(Math.min(xxQ1, xxQ3), yy,↵

20

                box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3),↵

21

                        Math.abs(xxQ1 - xxQ3), state.getBarWidth());↵

21

                        state.getBarWidth(), Math.abs(yyQ1 - yyQ3));↵

22

                if (this.fillBox) {↵

22

                if (this.fillBox) {↵

23

                    g2.fill(box);↵

23

                    g2.fill(box);↵

24

                }↵

24

                }↵

25

                g2.setStroke(getItemOutlineStroke(row, column));↵

25

                g2.setStroke(getItemOutlineStroke(row, column));↵

26

                g2.setPaint(getItemOutlinePaint(row, column));↵

26

                g2.setPaint(getItemOutlinePaint(row, column));↵

27

                g2.draw(box);↵

27

                g2.draw(box);↵

28

            }

28

            }

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 declared in the same class
Number of node comparisons | 200

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 15
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 107.1
   Clone type | Type 2

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

   24

       if (xQ1 != null && xQ3 != null && xMax != null && xMin != null)

   24 | if (xQ1 != null && xQ3 != null && xMax != null && xMin != null)
   28 | if (yQ1 != null && yQ3 != null && yMax != null && yMin != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xQ1 | yQ1 | VARIABLE_NAME_MISMATCH
   xQ3 | yQ3 | VARIABLE_NAME_MISMATCH
   xMax | yMax | VARIABLE_NAME_MISMATCH
   xMin | yMin | VARIABLE_NAME_MISMATCH

   28

       if (yQ1 != null && yQ3 != null && yMax != null && yMin != null)

   25

       double xxQ1 = rangeAxis.valueToJava2D(xQ1.doubleValue(), dataArea, location);

   25 | double xxQ1 = rangeAxis.valueToJava2D(xQ1.doubleValue(), dataArea, location);
   29 | double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea, location);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxQ1 | yyQ1 | VARIABLE_NAME_MISMATCH
   xQ1 | yQ1 | VARIABLE_NAME_MISMATCH

   29

       double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea, location);

   26

       double xxQ3 = rangeAxis.valueToJava2D(xQ3.doubleValue(), dataArea, location);

   26 | double xxQ3 = rangeAxis.valueToJava2D(xQ3.doubleValue(), dataArea, location);
   30 | double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea, location);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxQ3 | yyQ3 | VARIABLE_NAME_MISMATCH
   xQ3 | yQ3 | VARIABLE_NAME_MISMATCH

   30

       double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea, location);

   27

       double xxMax = rangeAxis.valueToJava2D(xMax.doubleValue(), dataArea, location);

   27 | double xxMax = rangeAxis.valueToJava2D(xMax.doubleValue(), dataArea, location);
   31 | double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(), dataArea, location);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMax | yyMax | VARIABLE_NAME_MISMATCH
   xMax | yMax | VARIABLE_NAME_MISMATCH

   31

       double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(), dataArea, location);

   28

       double xxMin = rangeAxis.valueToJava2D(xMin.doubleValue(), dataArea, location);

   28 | double xxMin = rangeAxis.valueToJava2D(xMin.doubleValue(), dataArea, location);
   32 | double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(), dataArea, location);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMin | yyMin | VARIABLE_NAME_MISMATCH
   xMin | yMin | VARIABLE_NAME_MISMATCH

   32

       double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(), dataArea, location);

   29

       double yymid = yy + state.getBarWidth() / 2.0;

   29 | double yymid = yy + state.getBarWidth() / 2.0;
   33 | double xxmid = xx + state.getBarWidth() / 2.0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   yymid | xxmid | VARIABLE_NAME_MISMATCH
   yy | xx | VARIABLE_NAME_MISMATCH

   33

       double xxmid = xx + state.getBarWidth() / 2.0;

   30

       g2.draw(new Line2D.Double(xxMax, yymid, xxQ3, yymid));

   30 | g2.draw(new Line2D.Double(xxMax, yymid, xxQ3, yymid));
   35 | g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(), yyMax));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMax | xx | VARIABLE_NAME_MISMATCH
   yymid | yyMax | VARIABLE_NAME_MISMATCH
   xxQ3 | xx + state.getBarWidth() | TYPE_COMPATIBLE_REPLACEMENT
   yymid | yyMax | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression xxQ3 cannot be parameterized, because it has dependencies to/from statements that will be extracted

   35

       g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(), yyMax));

   31

       g2.draw(new Line2D.Double(xxMax, yy, xxMax, yy + state.getBarWidth()));

   31 | g2.draw(new Line2D.Double(xxMax, yy, xxMax, yy + state.getBarWidth()));
   37 | g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(), yyMin));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMax | xx | VARIABLE_NAME_MISMATCH
   yy | yyMin | VARIABLE_NAME_MISMATCH
   xxMax | xx + state.getBarWidth() | TYPE_COMPATIBLE_REPLACEMENT
   yy + state.getBarWidth() | yyMin | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xxMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted

   37

       g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(), yyMin));

   32

       g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid));

   32 | g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid));
   34 | g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMin | xxmid | VARIABLE_NAME_MISMATCH
   yymid | yyMax | VARIABLE_NAME_MISMATCH
   xxQ1 | xxmid | VARIABLE_NAME_MISMATCH
   yymid | yyQ3 | VARIABLE_NAME_MISMATCH

   Preondition Violations
   Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted

   34

       g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3));

   33

       g2.draw(new Line2D.Double(xxMin, yy, xxMin, yy + state.getBarWidth()));

   33 | g2.draw(new Line2D.Double(xxMin, yy, xxMin, yy + state.getBarWidth()));
   36 | g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   xxMin | xxmid | VARIABLE_NAME_MISMATCH
   yy | yyMin | VARIABLE_NAME_MISMATCH
   xxMin | xxmid | VARIABLE_NAME_MISMATCH
   yy + state.getBarWidth() | yyQ1 | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression yyQ1 cannot be parameterized, because it has dependencies to/from statements that will be extracted

   36

       g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1));

   34

       box = new Rectangle2D.Double(Math.min(xxQ1, xxQ3), yy, Math.abs(xxQ1 - xxQ3), state.getBarWidth());

   34 | box = new Rectangle2D.Double(Math.min(xxQ1, xxQ3), yy, Math.abs(xxQ1 - xxQ3), state.getBarWidth());

   Preondition Violations
   Unmatched statement box=new Rectangle2D.Double(Math.min(xxQ1,xxQ3),yy,Math.abs(xxQ1 - xxQ3),state.getBarWidth()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   38 | box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3), state.getBarWidth(), Math.abs(yyQ1 - yyQ3));

   Preondition Violations
   Unmatched statement box=new Rectangle2D.Double(xx,Math.min(yyQ1,yyQ3),state.getBarWidth(),Math.abs(yyQ1 - yyQ3)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   38

       box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3), state.getBarWidth(), Math.abs(yyQ1 - yyQ3));

   35

       if (this.fillBox)

   39

       if (this.fillBox)

   36

       g2.fill(box);

   40

       g2.fill(box);

   37

       g2.setStroke(getItemOutlineStroke(row, column));

   41

       g2.setStroke(getItemOutlineStroke(row, column));

   38

       g2.setPaint(getItemOutlinePaint(row, column));

   42

       g2.setPaint(getItemOutlinePaint(row, column));

   39

       g2.draw(box);

   43

       g2.draw(box);

   Precondition Violations (15)
   Row | Violation
   --- | ---
   1 | Expression xxQ3 cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression xxMax cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Expression yyMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   10 | Expression xxMin cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression xxmid cannot be parameterized, because it has dependencies to/from statements that will be extracted
   12 | Expression yyQ1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
   13 | Unmatched statement box=new Rectangle2D.Double(Math.min(xxQ1,xxQ3),yy,Math.abs(xxQ1 - xxQ3),state.getBarWidth()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   14 | Unmatched statement box=new Rectangle2D.Double(xx,Math.min(yyQ1,yyQ3),state.getBarWidth(),Math.abs(yyQ1 - yyQ3)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   15 | Clone fragment #1 returns variables xxQ1, xxQ3 , while Clone fragment #2 returns variables yyQ1, yyQ3