if (hAlign == HorizontalAlignment.LEFT) { x = frame.getX(); } else if (hAlign == HorizontalAlignment.CENTER) { x = frame.getCenterX() - (dimensions.width / 2.0); } else if (hAlign == HorizontalAlignment.RIGHT) { x = frame.getMaxX() - dimensions.width; }
if (vAlign == VerticalAlignment.TOP) { y = frame.getY(); } else if (vAlign == VerticalAlignment.CENTER) { y = frame.getCenterY() - (dimensions.height / 2.0); } else if (vAlign == VerticalAlignment.BOTTOM) { y = frame.getMaxY() - dimensions.height; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java
Method name: Rectangle2D createAlignedRectangle2D(Size2D, Rectangle2D, HorizontalAlignment, VerticalAlignment) Method name: Rectangle2D createAlignedRectangle2D(Size2D, Rectangle2D, HorizontalAlignment, VerticalAlignment)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (hAlign == HorizontalAlignment.LEFT) {
1
if (vAlign == VerticalAlignment.TOP) {
2
            x = frame.getX();
2
            y = frame.getY();
3
        }
3
        }
4
        else if (hAlign == HorizontalAlignment.CENTER) {
4
        else if (vAlign == VerticalAlignment.CENTER) {
5
            x = frame.getCenterX() - (dimensions.width / 2.0);
5
            y = frame.getCenterY() - (dimensions.height / 2.0);
6
        }
6
        }
7
        else if (hAlign == HorizontalAlignment.RIGHT) {
7
        else if (vAlign == VerticalAlignment.BOTTOM) {
8
            x = frame.getMaxX() - dimensions.width;
8
            y = frame.getMaxY() - dimensions.height;
9
        }
9
        }
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)1.0
Clones locationClones are in the same method
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)5.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (hAlign == HorizontalAlignment.LEFT)
    3
    if (hAlign == HorizontalAlignment.LEFT)
    9
    if (vAlign == VerticalAlignment.TOP)
    Differences
    Expression1Expression2Difference
    hAlignvAlignVARIABLE_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 hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    • 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
    9
    if (vAlign == VerticalAlignment.TOP)
    4
    x = frame.getX();
    4
    x = frame.getX();
    10
    y = frame.getY();
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getXgetYMETHOD_INVOCATION_NAME_MISMATCH
    10
    y = frame.getY();
    5
    else if (hAlign == HorizontalAlignment.CENTER)
    5
    else if (hAlign == HorizontalAlignment.CENTER)
    11
    else if (vAlign == VerticalAlignment.CENTER)
    Differences
    Expression1Expression2Difference
    hAlignvAlignVARIABLE_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 hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    • 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
    11
    else if (vAlign == VerticalAlignment.CENTER)
    6
    x = frame.getCenterX() - (dimensions.width / 2.0);
    6
    x = frame.getCenterX() - (dimensions.width / 2.0);
    12
    y = frame.getCenterY() - (dimensions.height / 2.0);
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getCenterXgetCenterYMETHOD_INVOCATION_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    12
    y = frame.getCenterY() - (dimensions.height / 2.0);
    7
    else if (hAlign == HorizontalAlignment.RIGHT)
    7
    else if (hAlign == HorizontalAlignment.RIGHT)
    13
    else if (vAlign == VerticalAlignment.BOTTOM)
    Differences
    Expression1Expression2Difference
    hAlignvAlignVARIABLE_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 hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    • 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
    13
    else if (vAlign == VerticalAlignment.BOTTOM)
    8
    x = frame.getMaxX() - dimensions.width;
    8
    x = frame.getMaxX() - dimensions.width;
    14
    y = frame.getMaxY() - dimensions.height;
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    getMaxXgetMaxYMETHOD_INVOCATION_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    14
    y = frame.getMaxY() - dimensions.height;
    Precondition Violations (9)
    Row Violation
    1Type org.jfree.ui.HorizontalAlignment of variable hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    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 hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    5Type org.jfree.ui.HorizontalAlignment does not match with type org.jfree.ui.VerticalAlignment
    6Type org.jfree.ui.HorizontalAlignment of variable HorizontalAlignment.CENTER does not match with type org.jfree.ui.VerticalAlignment of variable VerticalAlignment.CENTER
    7Type org.jfree.ui.HorizontalAlignment of variable hAlign does not match with type org.jfree.ui.VerticalAlignment of variable vAlign
    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