for (Object object : mappingCollection) { Mapping mapping = (Mapping)object; for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); ) { Mapping childMapping = mappings.next(); mappingRoot.register(childMapping); } }
for (Object object : mappingCollection) { Mapping mapping = (Mapping)object; for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); ) { Mapping childMapping = mappings.next(); mappingRoot.deregister(childMapping); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/provider/MappingItemProvider.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/provider/MappingItemProvider.java
Method name: void register() Method name: void deregister()
Number of AST nodes: 5 Number of AST nodes: 5
1
for (Object object : mappingCollection)
1
for (Object object : mappingCollection)
2
            {
2
            {
3
              Mapping mapping = (Mapping)object;
3
              Mapping mapping = (Mapping)object;
4
              for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
4
              for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
5
              {
5
              {
6
                Mapping childMapping = mappings.next();
6
                Mapping childMapping = mappings.next();
7
                mappingRoot.register(childMapping);
7
                mappingRoot.deregister(childMapping);
8
              }
8
              }
9
            }
9
            }
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.4
Clones locationClones are declared in the same class
Number of node comparisons13
  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)17.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    Mapping mapping = (Mapping)object;
    2
    Mapping mapping = (Mapping)object;
    3
    for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
    3
    for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
    3
    for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
    Differences
    Expression1Expression2Difference
    registerderegisterMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression mappingRoot.register(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappingRoot.deregister(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappingRoot.register(childMapping) is a void method call, and thus it cannot be parameterized
    Expression mappingRoot.deregister(childMapping) is a void method call, and thus it cannot be parameterized
    3
    for (TreeIterator<Mapping> mappings = mapping.treeIterator(); mappings.hasNext(); )
    4
    Mapping childMapping = mappings.next();
    4
    Mapping childMapping = mappings.next();
    5
    mappingRoot.register(childMapping);
    5
    mappingRoot.register(childMapping);
    5
    mappingRoot.deregister(childMapping);
    Differences
    Expression1Expression2Difference
    registerderegisterMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression mappingRoot.register(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappingRoot.deregister(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappingRoot.register(childMapping) is a void method call, and thus it cannot be parameterized
    Expression mappingRoot.deregister(childMapping) is a void method call, and thus it cannot be parameterized
    5
    mappingRoot.deregister(childMapping);
    Precondition Violations (8)
    Row Violation
    1Expression mappingRoot.register(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression mappingRoot.deregister(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression mappingRoot.register(childMapping) is a void method call, and thus it cannot be parameterized
    4Expression mappingRoot.deregister(childMapping) is a void method call, and thus it cannot be parameterized
    5Expression mappingRoot.register(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression mappingRoot.deregister(childMapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression mappingRoot.register(childMapping) is a void method call, and thus it cannot be parameterized
    8Expression mappingRoot.deregister(childMapping) is a void method call, and thus it cannot be parameterized