1048-1-2

if (exactBoxWidth <= 0.0) { int itemCount = boxAndWhiskerData.getItemCount(series); exactBoxWidth = dataAreaX / itemCount * 4.5 / 7; if (exactBoxWidth < 3) { width = 3; } else if (exactBoxWidth > maxBoxWidth) { width = maxBoxWidth; } else { width = exactBoxWidth; } }
if (exactBoxWidth <= 0.0) { int itemCount = boxAndWhiskerData.getItemCount(series); exactBoxWidth = dataAreaX / itemCount * 4.5 / 7; if (exactBoxWidth < 3) { width = 3; } else if (exactBoxWidth > maxBoxWidth) { width = maxBoxWidth; } else { width = exactBoxWidth; } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBoxAndWhiskerRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBoxAndWhiskerRenderer.java
Method name: `void drawHorizontalItem(Graphics2D, Rectangle2D, PlotRenderingInfo, XYPlot, ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int)` |  | Method name: `void drawVerticalItem(Graphics2D, Rectangle2D, PlotRenderingInfo, XYPlot, ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    if (exactBoxWidth <= 0.0) {↵

1

    if (exactBoxWidth <= 0.0) {↵

2

                int itemCount = boxAndWhiskerData.getItemCount(series);↵

2

                int itemCount = boxAndWhiskerData.getItemCount(series);↵

3

                exactBoxWidth = dataAreaX / itemCount * 4.5 / 7;↵

3

                exactBoxWidth = dataAreaX / itemCount * 4.5 / 7;↵

4

                if (exactBoxWidth < 3) {↵

4

                if (exactBoxWidth < 3) {↵

5

                    width = 3;↵

5

                    width = 3;↵

6

                }↵

6

                } ↵

7

                else if (exactBoxWidth > maxBoxWidth) {↵

7

                else if (exactBoxWidth > maxBoxWidth) {↵

8

                    width = maxBoxWidth;↵

8

                    width = maxBoxWidth;↵

9

                }↵

9

                } ↵

10

                else {↵

10

                else {↵

11

                    width = exactBoxWidth;↵

11

                    width = exactBoxWidth;↵

12

                }↵

12

                }↵

13

            }

13

            }

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

1. {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) | 1.5
   Clone type | Type 1

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

   27

       if (exactBoxWidth <= 0.0)

   29

       if (exactBoxWidth <= 0.0)

   28

       int itemCount = boxAndWhiskerData.getItemCount(series);

   30

       int itemCount = boxAndWhiskerData.getItemCount(series);

   29

       exactBoxWidth = dataAreaX / itemCount * 4.5 / 7;

   31

       exactBoxWidth = dataAreaX / itemCount * 4.5 / 7;

   30

       if (exactBoxWidth < 3)

   32

       if (exactBoxWidth < 3)

   31

       width = 3;

   33

       width = 3;

   32

       else if (exactBoxWidth > maxBoxWidth)

   34

       else if (exactBoxWidth > maxBoxWidth)

   33

       width = maxBoxWidth;

   35

       width = maxBoxWidth;

       else

       else

   34

       width = exactBoxWidth;

   36

       width = exactBoxWidth;

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