RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w;
RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight()); Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f); double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis.java File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis.java
Method name: double calculateTextBlockWidth(TextBlock, CategoryLabelPosition, Graphics2D) Method name: double calculateTextBlockHeight(TextBlock, CategoryLabelPosition, Graphics2D)
Number of AST nodes: 6 Number of AST nodes: 6
1
RectangleInsets insets = getTickLabelInsets();
1
RectangleInsets insets = getTickLabelInsets();
2
        Size2D size = block.calculateDimensions(g2);
2
        Size2D size = block.calculateDimensions(g2);
3
        Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(),
3
        Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(),
4
                size.getHeight());
4
                size.getHeight());
5
        Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(),
5
        Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(),
6
                0.0f, 0.0f);
6
                0.0f, 0.0f);
7
        double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft()
7
        double h = rotatedBox.getBounds2D().getHeight()
8
                + insets.getRight();
8
                   + insets.getTop() + insets.getBottom();
9
        return w;
9
        return h;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {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)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RectangleInsets insets = getTickLabelInsets();
    1
    RectangleInsets insets = getTickLabelInsets();
    2
    Size2D size = block.calculateDimensions(g2);
    2
    Size2D size = block.calculateDimensions(g2);
    3
    Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight());
    3
    Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), size.getHeight());
    4
    Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f);
    4
    Shape rotatedBox = ShapeUtilities.rotateShape(box, position.getAngle(), 0.0f, 0.0f);
    5
    double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight();
    5
    double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight();
    5
    double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom();
    Differences
    Expression1Expression2Difference
    whVARIABLE_NAME_MISMATCH
    getRightgetBottomMETHOD_INVOCATION_NAME_MISMATCH
    getWidthgetHeightMETHOD_INVOCATION_NAME_MISMATCH
    getLeftgetTopMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression insets.getRight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.getBottom() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rotatedBox.getBounds2D().getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rotatedBox.getBounds2D().getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.getLeft() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.getTop() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom();
    6
    return w;
    6
    return w;
    6
    return h;
    Differences
    Expression1Expression2Difference
    whVARIABLE_NAME_MISMATCH
    6
    return h;
    Precondition Violations (6)
    Row Violation
    1Expression insets.getRight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression insets.getBottom() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression rotatedBox.getBounds2D().getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression rotatedBox.getBounds2D().getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression insets.getLeft() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression insets.getTop() cannot be parameterized, because it has dependencies to/from statements that will be extracted