419-1-2

if (drawUpOrRight) { double x = 0.0; double y = 0.0; Shape arrow = null; if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) { x = dataArea.getMaxX(); y = cursor; arrow = this.rightArrow; } else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) { x = cursor; y = dataArea.getMinY(); arrow = this.upArrow; } // draw the arrow... AffineTransform transformer = new AffineTransform(); transformer.setToTranslation(x, y); Shape shape = transformer.createTransformedShape(arrow); g2.fill(shape); g2.draw(shape); }
if (drawDownOrLeft) { double x = 0.0; double y = 0.0; Shape arrow = null; if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) { x = dataArea.getMinX(); y = cursor; arrow = this.leftArrow; } else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) { x = cursor; y = dataArea.getMaxY(); arrow = this.downArrow; } // draw the arrow... AffineTransform transformer = new AffineTransform(); transformer.setToTranslation(x, y); Shape shape = transformer.createTransformedShape(arrow); g2.fill(shape); g2.draw(shape); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java
Method name: `void drawAxisLine(Graphics2D, double, Rectangle2D, RectangleEdge)` |  | Method name: `void drawAxisLine(Graphics2D, double, Rectangle2D, RectangleEdge)`
Number of AST nodes: 17 |  | Number of AST nodes: 17

1

    if (drawUpOrRight) {↵

1

    if (drawDownOrLeft) {↵

2

                double x = 0.0;↵

2

                double x = 0.0;↵

3

                double y = 0.0;↵

3

                double y = 0.0;↵

4

                Shape arrow = null;↵

4

                Shape arrow = null;↵

5

                if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) {↵

5

                if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) {↵

6

                    x = dataArea.getMaxX();↵

6

                    x = dataArea.getMinX();↵

7

                    y = cursor;↵

7

                    y = cursor;↵

8

                    arrow = this.rightArrow;↵

8

                    arrow = this.leftArrow;↵

9

                }↵

9

                }↵

10

                else if (edge == RectangleEdge.LEFT↵

10

                else if (edge == RectangleEdge.LEFT↵

11

                        || edge == RectangleEdge.RIGHT) {↵

11

                        || edge == RectangleEdge.RIGHT) {↵

12

                    x = cursor;↵

12

                    x = cursor;↵

13

                    y = dataArea.getMinY();↵

13

                    y = dataArea.getMaxY();↵

14

                    arrow = this.upArrow;↵

14

                    arrow = this.downArrow;↵

15

                }↵

15

                }↵

16

                // draw the arrow...↵

16

                // draw the arrow...↵

17

                AffineTransform transformer = new AffineTransform();↵

17

                AffineTransform transformer = new AffineTransform();↵

18

                transformer.setToTranslation(x, y);↵

18

                transformer.setToTranslation(x, y);↵

19

                Shape shape = transformer.createTransformedShape(arrow);↵

19

                Shape shape = transformer.createTransformedShape(arrow);↵

20

                g2.fill(shape);↵

20

                g2.fill(shape);↵

21

                g2.draw(shape);↵

21

                g2.draw(shape);↵

22

            }

22

            }

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.7
Clones location | Clones are in the same method
Number of node comparisons | 130

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 17
   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) | 4.9
   Clone type | Type 2

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

   23

       if (drawUpOrRight)

   23 | if (drawUpOrRight)
   40 | if (drawDownOrLeft)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   drawUpOrRight | drawDownOrLeft | VARIABLE_NAME_MISMATCH

   40

       if (drawDownOrLeft)

   24

       double x = 0.0;

   41

       double x = 0.0;

   25

       double y = 0.0;

   42

       double y = 0.0;

   26

       Shape arrow = null;

   43

       Shape arrow = null;

   27

       if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM)

   44

       if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM)

   28

       x = dataArea.getMaxX();

   28 | x = dataArea.getMaxX();
   45 | x = dataArea.getMinX();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMaxX | getMinX | METHOD_INVOCATION_NAME_MISMATCH

   45

       x = dataArea.getMinX();

   29

       y = cursor;

   46

       y = cursor;

   30

       arrow = this.rightArrow;

   30 | arrow = this.rightArrow;
   47 | arrow = this.leftArrow;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   rightArrow | leftArrow | VARIABLE_NAME_MISMATCH

   47

       arrow = this.leftArrow;

   31

       else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT)

   48

       else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT)

   32

       x = cursor;

   49

       x = cursor;

   33

       y = dataArea.getMinY();

   33 | y = dataArea.getMinY();
   50 | y = dataArea.getMaxY();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getMinY | getMaxY | METHOD_INVOCATION_NAME_MISMATCH

   50

       y = dataArea.getMaxY();

   34

       arrow = this.upArrow;

   34 | arrow = this.upArrow;
   51 | arrow = this.downArrow;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   upArrow | downArrow | VARIABLE_NAME_MISMATCH

   51

       arrow = this.downArrow;

   35

       AffineTransform transformer = new AffineTransform();

   52

       AffineTransform transformer = new AffineTransform();

   36

       transformer.setToTranslation(x, y);

   53

       transformer.setToTranslation(x, y);

   37

       Shape shape = transformer.createTransformedShape(arrow);

   54

       Shape shape = transformer.createTransformedShape(arrow);

   38

       g2.fill(shape);

   55

       g2.fill(shape);

   39

       g2.draw(shape);

   56

       g2.draw(shape);

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