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; }
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; }
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: 9 Number of AST nodes: 9
1
if (horizontalAlignment == HorizontalAlignment.LEFT) {
1
if (verticalAlignment == VerticalAlignment.TOP) {
2
            x = (float) titleArea.getX();
2
            y = (float) titleArea.getY();
3
            anchor = TextBlockAnchor.TOP_LEFT;
3
            anchor = TextBlockAnchor.TOP_RIGHT;
4
        }
4
        }
5
        else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
5
        else if (verticalAlignment == VerticalAlignment.BOTTOM) {
6
            x = (float) titleArea.getMaxX();
6
            y = (float) titleArea.getMaxY();
7
            anchor = TextBlockAnchor.TOP_RIGHT;
7
            anchor = TextBlockAnchor.TOP_LEFT;
8
        }
8
        }
9
        else if (horizontalAlignment == HorizontalAlignment.CENTER) {
9
        else if (verticalAlignment == VerticalAlignment.CENTER) {
10
            x = (float) titleArea.getCenterX();
10
            y = (float) titleArea.getCenterY();
11
            anchor = TextBlockAnchor.TOP_CENTER;
11
            anchor = TextBlockAnchor.TOP_CENTER;
12
        }
12
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.9
Clones locationClones are declared in the same class
Number of node comparisons57
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    if (horizontalAlignment == HorizontalAlignment.LEFT)
    7
    if (horizontalAlignment == HorizontalAlignment.LEFT)
    7
    if (verticalAlignment == VerticalAlignment.TOP)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentverticalAlignmentVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    LEFTTOPVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.LEFT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.TOP
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    7
    if (verticalAlignment == VerticalAlignment.TOP)
    8
    x = (float)titleArea.getX();
    8
    x = (float)titleArea.getX();
    8
    y = (float)titleArea.getY();
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getXgetYMETHOD_INVOCATION_NAME_MISMATCH
    8
    y = (float)titleArea.getY();
    9
    anchor = TextBlockAnchor.TOP_LEFT;
    9
    anchor = TextBlockAnchor.TOP_LEFT;
    9
    anchor = TextBlockAnchor.TOP_RIGHT;
    Differences
    Expression1Expression2Difference
    TOP_LEFTTOP_RIGHTVARIABLE_NAME_MISMATCH
    9
    anchor = TextBlockAnchor.TOP_RIGHT;
    10
    else if (horizontalAlignment == HorizontalAlignment.RIGHT)
    10
    else if (horizontalAlignment == HorizontalAlignment.RIGHT)
    10
    else if (verticalAlignment == VerticalAlignment.BOTTOM)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentverticalAlignmentVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    RIGHTBOTTOMVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.RIGHT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.BOTTOM
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    10
    else if (verticalAlignment == VerticalAlignment.BOTTOM)
    11
    x = (float)titleArea.getMaxX();
    11
    x = (float)titleArea.getMaxX();
    11
    y = (float)titleArea.getMaxY();
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getMaxXgetMaxYMETHOD_INVOCATION_NAME_MISMATCH
    11
    y = (float)titleArea.getMaxY();
    12
    anchor = TextBlockAnchor.TOP_RIGHT;
    12
    anchor = TextBlockAnchor.TOP_RIGHT;
    12
    anchor = TextBlockAnchor.TOP_LEFT;
    Differences
    Expression1Expression2Difference
    TOP_RIGHTTOP_LEFTVARIABLE_NAME_MISMATCH
    12
    anchor = TextBlockAnchor.TOP_LEFT;
    13
    else if (horizontalAlignment == HorizontalAlignment.CENTER)
    13
    else if (horizontalAlignment == HorizontalAlignment.CENTER)
    13
    else if (verticalAlignment == VerticalAlignment.CENTER)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentverticalAlignmentVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    13
    else if (verticalAlignment == VerticalAlignment.CENTER)
    14
    x = (float)titleArea.getCenterX();
    14
    x = (float)titleArea.getCenterX();
    14
    y = (float)titleArea.getCenterY();
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getCenterXgetCenterYMETHOD_INVOCATION_NAME_MISMATCH
    14
    y = (float)titleArea.getCenterY();
    15
    anchor = TextBlockAnchor.TOP_CENTER;
    15
    anchor = TextBlockAnchor.TOP_CENTER;
    Precondition Violations (10)
    Row Violation
    1Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    2Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    3Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.LEFT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.TOP
    4Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    5Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    6Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.RIGHT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.BOTTOM
    7Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable verticalAlignment
    8Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    9Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER
    10Clone fragment #1 returns variables x, anchor , while Clone fragment #2 returns variables y, anchor