Size2D s = arrangeNF(container, g2, constraint); if (constraint.getWidthRange().contains(s.width)) { return s; } else { RectangleConstraint c = constraint.toFixedWidth( constraint.getWidthRange().constrain(s.getWidth())); return arrangeFF(container, g2, c); }
Size2D s = arrangeFN(container, g2, constraint); if (constraint.getHeightRange().contains(s.height)) { return s; } else { RectangleConstraint c = constraint.toFixedHeight( constraint.getHeightRange().constrain(s.getHeight()) ); return arrangeFF(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/FlowArrangement.java
Method name: Size2D arrangeRF(BlockContainer, Graphics2D, RectangleConstraint) Method name: Size2D arrangeFR(BlockContainer, Graphics2D, RectangleConstraint)
Number of AST nodes: 5 Number of AST nodes: 5
1
Size2D s = arrangeNF(container, g2, constraint);
1
Size2D s = arrangeFN(container, g2, constraint);
2
        if (constraint.getWidthRange().contains(s.width)) {
2
        if (constraint.getHeightRange().contains(s.height)) {
3
            return s;   
3
            return s;   
4
        }
4
        }
5
        else {
5
        else {
6
            RectangleConstraint c = constraint.toFixedWidth(
6
            RectangleConstraint c = constraint.toFixed
7
    
7
Height(
8
                constraint.getWidthRange().constrain(s.getWidth())
8
                constraint.getHeightRange().constrain(s.getHeight())
9
);
9
            );
10
            return arrangeFF(container, g2, c);
10
            return arrangeFF(container, g2, c);
11
        }
11
        }
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 comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)503.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Size2D s = arrangeNF(container, g2, constraint);
    1
    Size2D s = arrangeNF(container, g2, constraint);
    1
    Size2D s = arrangeFN(container, g2, constraint);
    Differences
    Expression1Expression2Difference
    arrangeNFarrangeFNMETHOD_INVOCATION_NAME_MISMATCH
    1
    Size2D s = arrangeFN(container, g2, constraint);
    2
    if (constraint.getWidthRange().contains(s.width))
    2
    if (constraint.getWidthRange().contains(s.width))
    2
    if (constraint.getHeightRange().contains(s.height))
    Differences
    Expression1Expression2Difference
    widthheightVARIABLE_NAME_MISMATCH
    getWidthRangegetHeightRangeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression s.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (constraint.getHeightRange().contains(s.height))
    3
    return s;
    3
    return s;
    else
    else
    4
    RectangleConstraint c = constraint.toFixedWidth(constraint.getWidthRange().constrain(s.getWidth()));
    4
    RectangleConstraint c = constraint.toFixedWidth(constraint.getWidthRange().constrain(s.getWidth()));
    4
    RectangleConstraint c = constraint.toFixedHeight(constraint.getHeightRange().constrain(s.getHeight()));
    Differences
    Expression1Expression2Difference
    getWidthgetHeightMETHOD_INVOCATION_NAME_MISMATCH
    getWidthRangegetHeightRangeMETHOD_INVOCATION_NAME_MISMATCH
    toFixedWidthtoFixedHeightMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression s.getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s.getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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().constrain(s.getWidth())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression constraint.toFixedHeight(constraint.getHeightRange().constrain(s.getHeight())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    RectangleConstraint c = constraint.toFixedHeight(constraint.getHeightRange().constrain(s.getHeight()));
    5
    return arrangeFF(container, g2, c);
    5
    return arrangeFF(container, g2, c);
    Precondition Violations (8)
    Row Violation
    1Expression s.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression s.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s.getWidth() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression s.getHeight() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression constraint.getWidthRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression constraint.getHeightRange() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression constraint.toFixedWidth(constraint.getWidthRange().constrain(s.getWidth())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression constraint.toFixedHeight(constraint.getHeightRange().constrain(s.getHeight())) cannot be parameterized, because it has dependencies to/from statements that will be extracted