for (int i = 0; i < view.getViewCount(); i++) { childAllocation = view.getChildAllocation(i, allocation); if (childAllocation != null) { childView = view.getView(i); // calculate break height for child, and use updated // value in the further processing breakHeight = calcBreakHeightFromView(childView, childAllocation, breakHeight); } }
for (int i = 0; i < view.getViewCount(); i++) { childAllocation = view.getChildAllocation(i, allocation); if (childAllocation != null) { childView = view.getView(i); // handle child view by recursive call printView(g, childView, childAllocation, maxHeight); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/print/cHTMLPart.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/print/cHTMLPart.java
Method name: double calcBreakHeightFromView(View, Shape, double) Method name: void printView(Graphics2D, View, Shape, double)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int i = 0; i < view.getViewCount(); i++) {
1
for (int i = 0; i < view.getViewCount(); i++) {
2
                childAllocation = view.getChildAllocation(i, allocation);
2
                childAllocation = view.getChildAllocation(i, allocation);
3
                if (childAllocation != null) {
3
                if (childAllocation != null) {
4
                    childView = view.getView(i);
4
                    childView = view.getView(i);
5
                    // calculate break height for child, and use updated
5
                    // 
6
                    // value in the further processing
7
                    breakHeight = calcBreakHeightFrom
6
handle child view by recursive call
8
View(childView,
7
                    printView(g, childView,
9
                            childAllocation, breakHeight);
8
 childAllocation, maxHeight);
10
                }
9
                }
11
            }
10
            }
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.3
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0; i < view.getViewCount(); i++)
    4
    for (int i = 0; i < view.getViewCount(); i++)
    6
    childAllocation = view.getChildAllocation(i, allocation);
    5
    childAllocation = view.getChildAllocation(i, allocation);
    7
    if (childAllocation != null)
    6
    if (childAllocation != null)
    8
    childView = view.getView(i);
    7
    childView = view.getView(i);
                                                                                                            
    8
    printView(g, childView, childAllocation, maxHeight);
    Preondition Violations
    Unmatched statement printView(g,childView,childAllocation,maxHeight); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    printView(g, childView, childAllocation, maxHeight);
    9
    breakHeight = calcBreakHeightFromView(childView, childAllocation, breakHeight);
    9
    breakHeight = calcBreakHeightFromView(childView, childAllocation, breakHeight);
    Preondition Violations
    Unmatched statement breakHeight=calcBreakHeightFromView(childView,childAllocation,breakHeight); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                
    Precondition Violations (3)
    Row Violation
    1Unmatched statement printView(g,childView,childAllocation,maxHeight); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement breakHeight=calcBreakHeightFromView(childView,childAllocation,breakHeight); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables childAllocation, childView , while Clone fragment #2 returns variables childAllocation, childView