28-1-2

Rectangle2D titleArea = (Rectangle2D) area.clone(); g2.setFont(this.font); g2.setPaint(this.paint); TextBlockAnchor anchor = null; float x = 0.0f; HorizontalAlignment horizontalAlignment = getHorizontalAlignment(); if (horizontalAlignment == HorizontalAlignment.LEFT) { x = (float) titleArea.getX(); anchor = TextBlockAnchor.TOP_LEFT; } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { x = (float) titleArea.getMaxX(); anchor = TextBlockAnchor.TOP_RIGHT; } else if (horizontalAlignment == HorizontalAlignment.CENTER) { x = (float) titleArea.getCenterX(); anchor = TextBlockAnchor.TOP_CENTER; } float y = 0.0f; RectangleEdge position = getPosition(); if (position == RectangleEdge.TOP) { y = (float) titleArea.getY(); } else if (position == RectangleEdge.BOTTOM) { y = (float) titleArea.getMaxY(); if (horizontalAlignment == HorizontalAlignment.LEFT) { anchor = TextBlockAnchor.BOTTOM_LEFT; } else if (horizontalAlignment == HorizontalAlignment.CENTER) { anchor = TextBlockAnchor.BOTTOM_CENTER; } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { anchor = TextBlockAnchor.BOTTOM_RIGHT; } } this.content.draw(g2, x, y, anchor);
Rectangle2D titleArea = (Rectangle2D) area.clone(); g2.setFont(this.font); g2.setPaint(this.paint); TextBlockAnchor anchor = null; float y = 0.0f; VerticalAlignment verticalAlignment = getVerticalAlignment(); if (verticalAlignment == VerticalAlignment.TOP) { y = (float) titleArea.getY(); anchor = TextBlockAnchor.TOP_RIGHT; } else if (verticalAlignment == VerticalAlignment.BOTTOM) { y = (float) titleArea.getMaxY(); anchor = TextBlockAnchor.TOP_LEFT; } else if (verticalAlignment == VerticalAlignment.CENTER) { y = (float) titleArea.getCenterY(); anchor = TextBlockAnchor.TOP_CENTER; } float x = 0.0f; RectangleEdge position = getPosition(); if (position == RectangleEdge.LEFT) { x = (float) titleArea.getX(); } else if (position == RectangleEdge.RIGHT) { x = (float) titleArea.getMaxX(); if (verticalAlignment == VerticalAlignment.TOP) { anchor = TextBlockAnchor.BOTTOM_RIGHT; } else if (verticalAlignment == VerticalAlignment.CENTER) { anchor = TextBlockAnchor.BOTTOM_CENTER; } else if (verticalAlignment == VerticalAlignment.BOTTOM) { anchor = TextBlockAnchor.BOTTOM_LEFT; } } this.content.draw(g2, x, y, anchor, x, y, -Math.PI / 2.0);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java
Method name: `void drawHorizontal(Graphics2D, Rectangle2D)` |  | Method name: `void drawVertical(Graphics2D, Rectangle2D)`
Number of AST nodes: 28 |  | Number of AST nodes: 28

1

    Rectangle2D titleArea = (Rectangle2D) area.clone();↵

1

    Rectangle2D titleArea = (Rectangle2D) area.clone();↵

2

            g2.setFont(this.font);↵

2

            g2.setFont(this.font);↵

3

            g2.setPaint(this.paint);↵

3

            g2.setPaint(this.paint);↵

4

            TextBlockAnchor anchor = null;↵

4

            TextBlockAnchor anchor = null;↵

5

            float x = 0.0f;↵

5

            float y = 0.0f;↵

6

            HorizontalAlignment horizontalAlignment = getHorizontalAlignment();↵

6

            VerticalAlignment verticalAlignment = getVerticalAlignment();↵

7

            if (horizontalAlignment == HorizontalAlignment.LEFT) {↵

7

            if (verticalAlignment == VerticalAlignment.TOP) {↵

8

                x = (float) titleArea.getX();↵

8

                y = (float) titleArea.getY();↵

9

                anchor = TextBlockAnchor.TOP_LEFT;↵

9

                anchor = TextBlockAnchor.TOP_RIGHT;↵

10

            }↵

10

            }↵

11

            else if (horizontalAlignment == HorizontalAlignment.RIGHT) {↵

11

            else if (verticalAlignment == VerticalAlignment.BOTTOM) {↵

12

                x = (float) titleArea.getMaxX();↵

12

                y = (float) titleArea.getMaxY();↵

13

                anchor = TextBlockAnchor.TOP_RIGHT;↵

13

                anchor = TextBlockAnchor.TOP_LEFT;↵

14

            }↵

14

            }↵

15

            else if (horizontalAlignment == HorizontalAlignment.CENTER) {↵

15

            else if (verticalAlignment == VerticalAlignment.CENTER) {↵

16

                x = (float) titleArea.getCenterX();↵

16

                y = (float) titleArea.getCenterY();↵

17

                anchor = TextBlockAnchor.TOP_CENTER;↵

17

                anchor = TextBlockAnchor.TOP_CENTER;↵

18

            }↵

18

            }↵

19

            float y = 0.0f;↵

19

            float x = 0.0f;↵

20

            RectangleEdge position = getPosition();↵

20

            RectangleEdge position = getPosition();↵

21

            if (position == RectangleEdge.TOP) {↵

21

            if (position == RectangleEdge.LEFT) {↵

22

                y = (float) titleArea.getY();↵

22

                x = (float) titleArea.getX();↵

23

            }↵

23

            }↵

24

            else if (position == RectangleEdge.BOTTOM) {↵

24

            else if (position == RectangleEdge.RIGHT) {↵

25

                y = (float) titleArea.getMaxY();↵

25

                x = (float) titleArea.getMaxX();↵

26

                if (horizontalAlignment == HorizontalAlignment.LEFT) {↵

26

                if (verticalAlignment == VerticalAlignment.TOP) {↵

27

                    anchor = TextBlockAnchor.BOTTOM_LEFT;↵

27

                    anchor = TextBlockAnchor.BOTTOM_RIGHT;↵

28

                }↵

28

                }↵

29

                else if (horizontalAlignment == HorizontalAlignment.CENTER) {↵

29

                else if (verticalAlignment == VerticalAlignment.CENTER) {↵

30

                    anchor = TextBlockAnchor.BOTTOM_CENTER;↵

30

                    anchor = TextBlockAnchor.BOTTOM_CENTER;↵

31

                }↵

31

                }↵

32

                else if (horizontalAlignment == HorizontalAlignment.RIGHT) {↵

32

                else if (verticalAlignment == VerticalAlignment.BOTTOM) {↵

33

                    anchor = TextBlockAnchor.BOTTOM_RIGHT;↵

33

                    anchor = TextBlockAnchor.BOTTOM_LEFT;↵

34

                }↵

34

                }↵

35

            }↵

35

            }↵

36

            this.content.draw(g2, x, y, anchor);

36

            this.content.draw(g2, x, y, anchor, x, y, -Math.PI / 2.0);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.1
Clones location | Clones are declared in the same class
Number of node comparisons | 9