if (horizontalAlignment == HorizontalAlignment.CENTER) { startX = chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0 - w / 2.0; } else if (horizontalAlignment == HorizontalAlignment.LEFT) { startX = chartArea.getX() + leftSpace; } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w; }
if (alignment == VerticalAlignment.CENTER) { startY = chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0 - h / 2.0; } else if (alignment == VerticalAlignment.TOP) { startY = chartArea.getMinY() + topSpace; } else if (alignment == VerticalAlignment.BOTTOM) { startY = chartArea.getMaxY() - bottomSpace - h; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/ImageTitle.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/ImageTitle.java
Method name: Size2D drawHorizontal(Graphics2D, Rectangle2D) Method name: Size2D drawVertical(Graphics2D, Rectangle2D)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (horizontalAlignment == HorizontalAlignment.CENTER) {
1
if (alignment == VerticalAlignment.CENTER) {
2
            startX = chartArea.getX() + leftSpace
2
            startY = chartArea.getMinY() + topSpace
3
 + chartArea.getWidth() / 2.0
3
                     + chartArea.getHeight() / 2.0
4
                     - w / 2.0;
4
 - h / 2.0;
5
        }
5
        }
6
        else if (horizontalAlignment == HorizontalAlignment.LEFT) {
6
        else if (alignment == VerticalAlignment.TOP) {
7
            startX = chartArea.getX() + leftSpace;
7
            startY = chartArea.getMinY() + topSpace;
8
        }
8
        }
9
        else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
9
        else if (alignment == VerticalAlignment.BOTTOM) {
10
            startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w;
10
            startY = chartArea.getMaxY() - bottomSpace - h;
11
        }
11
        }
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.8
Clones locationClones are declared in the same class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    if (horizontalAlignment == HorizontalAlignment.CENTER)
    18
    if (horizontalAlignment == HorizontalAlignment.CENTER)
    21
    if (alignment == VerticalAlignment.TOP)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentalignmentVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    CENTERTOPVARIABLE_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 alignment
    • 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.TOP
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    21
    if (alignment == VerticalAlignment.TOP)
    19
    startX = chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0 - w / 2.0;
    19
    startX = chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0 - w / 2.0;
    22
    startY = chartArea.getMinY() + topSpace;
    Differences
    Expression1Expression2Difference
    startXstartYVARIABLE_NAME_MISMATCH
    -+OPERATOR_MISMATCH
    chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0chartArea.getMinY()INFIX_LEFT_OPERAND_MISMATCH
    w / 2.0topSpaceINFIX_RIGHT_OPERAND_MISMATCH
    22
    startY = chartArea.getMinY() + topSpace;
    20
    else if (horizontalAlignment == HorizontalAlignment.LEFT)
    20
    else if (horizontalAlignment == HorizontalAlignment.LEFT)
    19
    else if (alignment == VerticalAlignment.CENTER)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentalignmentVARIABLE_NAME_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.ui.HorizontalAlignmentorg.jfree.ui.VerticalAlignmentVARIABLE_TYPE_MISMATCH
    LEFTCENTERVARIABLE_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 alignment
    • 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.CENTER
    • Make classes org.jfree.ui.HorizontalAlignment and org.jfree.ui.VerticalAlignment extend a common superclass
    19
    else if (alignment == VerticalAlignment.CENTER)
    21
    startX = chartArea.getX() + leftSpace;
    21
    startX = chartArea.getX() + leftSpace;
    20
    startY = chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0 - h / 2.0;
    Differences
    Expression1Expression2Difference
    startXstartYVARIABLE_NAME_MISMATCH
    +-OPERATOR_MISMATCH
    chartArea.getX()chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0INFIX_LEFT_OPERAND_MISMATCH
    leftSpaceh / 2.0INFIX_RIGHT_OPERAND_MISMATCH
    20
    startY = chartArea.getMinY() + topSpace + chartArea.getHeight() / 2.0 - h / 2.0;
    22
    else if (horizontalAlignment == HorizontalAlignment.RIGHT)
    22
    else if (horizontalAlignment == HorizontalAlignment.RIGHT)
    23
    else if (alignment == VerticalAlignment.BOTTOM)
    Differences
    Expression1Expression2Difference
    horizontalAlignmentalignmentVARIABLE_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 alignment
    • 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
    23
    else if (alignment == VerticalAlignment.BOTTOM)
    23
    startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w;
    23
    startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w;
    24
    startY = chartArea.getMaxY() - bottomSpace - h;
    Differences
    Expression1Expression2Difference
    startXstartYVARIABLE_NAME_MISMATCH
    wbottomSpaceVARIABLE_NAME_MISMATCH
    chartArea.getX() + chartArea.getWidth() - rightSpacechartArea.getMaxY()INFIX_LEFT_OPERAND_MISMATCH
    chartArea.getX() + chartArea.getWidth() - rightSpace - wchartArea.getMaxY() - bottomSpace - hINFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    24
    startY = chartArea.getMaxY() - bottomSpace - h;
    Precondition Violations (9)
    Row Violation
    1Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable alignment
    2Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    3Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER 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 alignment
    5Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    6Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.LEFT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER
    7Type org.jfree.ui.HorizontalAlignment of variable horizontalAlignment does not match with type org.jfree.ui.VerticalAlignment of variable alignment
    8Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    9Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.RIGHT does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.BOTTOM