reset(); result = prepareDropLinkInsert(parent, children, i); if (result) { // We've switch the operation! // operation = DROP_LINK; }
reset(); result = prepareDropCopyInsert(parent, children, i); if (result) { // We've switch the operation! // operation = DROP_COPY; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/command/DragAndDropCommand.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/command/DragAndDropCommand.java
Method name: boolean prepareDropInsert() Method name: boolean prepareDropInsert()
Number of AST nodes: 4 Number of AST nodes: 4
1
reset();
1
reset();
2
        result = prepareDropLinkInsert(parent, children, i);
2
        result = prepareDropCopyInsert(parent, children, i);
3
        if (result)
3
        if (result)
4
        {
4
        {
5
          // We've switch the operation!
5
          // We've switch the operation!
6
          //
6
          //
7
          operation = DROP_LINK;
7
          operation = DROP_COPY;
8
        }
8
        }
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 in the same method
Number of node comparisons10
  1. {Non-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)22.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    31
    reset();
    26
    reset();
    32
    result = prepareDropLinkInsert(parent, children, i);
    32
    result = prepareDropLinkInsert(parent, children, i);
    27
    result = prepareDropCopyInsert(parent, children, i);
    Differences
    Expression1Expression2Difference
    prepareDropLinkInsertprepareDropCopyInsertMETHOD_INVOCATION_NAME_MISMATCH
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression prepareDropLinkInsert(parent,children,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression prepareDropCopyInsert(parent,children,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.Collection<> of variable children does not match with type java.util.Collection<> of variable children
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    27
    result = prepareDropCopyInsert(parent, children, i);
    33
    if (result)
    28
    if (result)
    34
    operation = DROP_LINK;
    34
    operation = DROP_LINK;
    29
    operation = DROP_COPY;
    Differences
    Expression1Expression2Difference
    DROP_LINKDROP_COPYVARIABLE_NAME_MISMATCH
    29
    operation = DROP_COPY;
    Precondition Violations (3)
    Row Violation
    1Expression prepareDropLinkInsert(parent,children,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression prepareDropCopyInsert(parent,children,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.util.Collection<> of variable children does not match with type java.util.Collection<> of variable children