if (constraint.getWidthRange().contains(s1.width)) { return s1; } else { RectangleConstraint c = constraint.toFixedWidth( constraint.getWidthRange().getUpperBound()); return arrangeFN(container, g2, c); }
if (constraint.getHeightRange().contains(s1.height)) { return s1; // TODO: we didn't check the width yet } else { RectangleConstraint c = constraint.toFixedHeight( constraint.getHeightRange().getUpperBound() ); return arrangeRF(container, g2, c); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/CenterArrangement.java File path: /jfreechart-1.0.10/src/org/jfree/chart/block/ColumnArrangement.java
Method name: Size2D arrangeRN(BlockContainer, Graphics2D, RectangleConstraint) Method name: Size2D arrangeRR(BlockContainer, Graphics2D, RectangleConstraint)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (constraint.getWidthRange().contains(s1.width)) {
1
if (constraint.getHeightRange().contains(s1.height)) {
2
            return s1;   
2
            return s1;  // TODO: we didn't check the width yet
3
        }
3
        }
4
        else {
4
        else {
5
            RectangleConstraint c = constraint.toFixedWidth(
5
            RectangleConstraint c = constraint.toFixed
6
    
6
Height(
7
                constraint.getWidthRange().getUpperBound()
7
                constraint.getHeightRange().getUpperBound()
8
);
8
            );
9
            return arrangeFN(container, g2, c);
9
            return arrangeRF(container, g2, c);
10
        }
10
        }
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.3
Clones locationClones are in different classes
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)509.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (constraint.getWidthRange().contains(s1.width))
    2
    if (constraint.getWidthRange().contains(s1.width))
    2
    if (constraint.getHeightRange().contains(s1.height))
    Differences
    Expression1Expression2Difference
    widthheightVARIABLE_NAME_MISMATCH
    getWidthRangegetHeightRangeMETHOD_INVOCATION_NAME_MISMATCH
    2
    if (constraint.getHeightRange().contains(s1.height))
    3
    return s1;
    3
    return s1;
    else
    else
    4
    RectangleConstraint c = constraint.toFixedWidth(constraint.getWidthRange().getUpperBound());
    4
    RectangleConstraint c = constraint.toFixedWidth(constraint.getWidthRange().getUpperBound());
    4
    RectangleConstraint c = constraint.toFixedHeight(constraint.getHeightRange().getUpperBound());
    Differences
    Expression1Expression2Difference
    getWidthRangegetHeightRangeMETHOD_INVOCATION_NAME_MISMATCH
    toFixedWidthtoFixedHeightMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression constraint.getWidthRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression constraint.getHeightRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression constraint.toFixedWidth(constraint.getWidthRange().getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression constraint.toFixedHeight(constraint.getHeightRange().getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    RectangleConstraint c = constraint.toFixedHeight(constraint.getHeightRange().getUpperBound());
    5
    return arrangeFN(container, g2, c);
    5
    return arrangeFN(container, g2, c);
    5
    return arrangeRF(container, g2, c);
    Differences
    Expression1Expression2Difference
    arrangeFNarrangeRFMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression arrangeFN(container,g2,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression arrangeRF(container,g2,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    return arrangeRF(container, g2, c);
    Precondition Violations (6)
    Row Violation
    1Expression constraint.getWidthRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression constraint.getHeightRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression constraint.toFixedWidth(constraint.getWidthRange().getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression constraint.toFixedHeight(constraint.getHeightRange().getUpperBound()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression arrangeFN(container,g2,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression arrangeRF(container,g2,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted