if (w == LengthConstraintType.RANGE) { if (h == LengthConstraintType.NONE) { throw new RuntimeException("Not implemented."); } else if (h == LengthConstraintType.FIXED) { return arrangeRF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { return arrangeRR(container, g2, constraint); } }
if (h == LengthConstraintType.NONE) { // find optimum height return arrangeFN(container, g2, constraint); } else if (h == LengthConstraintType.FIXED) { return arrangeFF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { // find optimum height and map to range return arrangeFR(container, g2, constraint); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/ColumnArrangement.java File path: /jfreechart-1.0.10/src/org/jfree/chart/block/GridArrangement.java
Method name: Size2D arrange(BlockContainer, Graphics2D, RectangleConstraint) Method name: Size2D arrange(BlockContainer, Graphics2D, RectangleConstraint)
Number of AST nodes: 7 Number of AST nodes: 6
1
if (w == LengthConstraintType.RANGE) {
1
if (h == LengthConstraintType.NONE) {
2
            if (h == LengthConstraintType.NONE) {
2
            
3
                throw new RuntimeException("Not implemented."
3
    // find optimum height
4
);  
4
                return arrangeFN(container, g2, constraint);  
5
            }
5
            }
6
            else if (h == LengthConstraintType.FIXED) {
6
            else if (h == LengthConstraintType.FIXED) {
7
                return arrangeRF(container, g2, constraint);  
7
                return arrangeFF(container, g2, constraint);
8
            }
8
            }
9
            else if (h == LengthConstraintType.RANGE) {
9
            else if (h == LengthConstraintType.RANGE) {
10
                // find optimum height and map to range
10
                return arrangeRR(container, g2, constraint);  
11
                return arrangeFR(container, g2, constraint);  
11
            }
12
            }
12
        }
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.7
Clones locationClones are in different classes
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)777.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    if (h == LengthConstraintType.NONE)
    11
    if (h == LengthConstraintType.NONE)
                                                                                                
    12
    return arrangeFN(container, g2, constraint);
    Preondition Violations
    Unmatched statement return arrangeFN(container,g2,constraint); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched return arrangeFN(container,g2,constraint);
    12
    return arrangeFN(container, g2, constraint);
    19
    throw new RuntimeException("Not implemented.");
    19
    throw new RuntimeException("Not implemented.");
    Preondition Violations
    Unmatched statement throw new RuntimeException("Not implemented."); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new RuntimeException("Not implemented.");
                                                                                                          
    20
    else if (h == LengthConstraintType.FIXED)
    13
    else if (h == LengthConstraintType.FIXED)
    21
    return arrangeRF(container, g2, constraint);
    21
    return arrangeRF(container, g2, constraint);
    14
    return arrangeFF(container, g2, constraint);
    Differences
    Expression1Expression2Difference
    arrangeRFarrangeFFMETHOD_INVOCATION_NAME_MISMATCH
    14
    return arrangeFF(container, g2, constraint);
    22
    else if (h == LengthConstraintType.RANGE)
    15
    else if (h == LengthConstraintType.RANGE)
    23
    return arrangeRR(container, g2, constraint);
    23
    return arrangeRR(container, g2, constraint);
    16
    return arrangeFR(container, g2, constraint);
    Differences
    Expression1Expression2Difference
    arrangeRRarrangeFRMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression arrangeFR(container,g2,constraint) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    16
    return arrangeFR(container, g2, constraint);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement return arrangeFN(container,g2,constraint); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched return arrangeFN(container,g2,constraint);
    3Unmatched statement throw new RuntimeException("Not implemented."); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched throw new RuntimeException("Not implemented.");
    5Expression arrangeFR(container,g2,constraint) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    6Not all possible execution flows end in a return statement