Object object = objects.next(); MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object); Object originatingInput = mappedObjectState.getOriginatingInput(); // This is tricky and is done for each object here rather than once for the owner of the addCommnd. // We want to make sure the object is really part of the conceptual tree induced by the domain. // if (originatingInput == null) { mappedObjectState.setOutput(); } else if (mappingRoot.isAttachedObject(object)) { mapOutputObject(object, originatingInput, subcommands); }
Object object = objects.next(); MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object); Object originatingInput = mappedObjectState.getOriginatingInput(); // This is tricky and is done for each object here rather than once for the owner of the addCommnd. // We want to make sure the object is really part of the conceptual tree induced by the domain. // if (originatingInput == null) { mappedObjectState.setOutput(); } else if (mappingRoot.isAttachedObject(object)) { subcommands.append(CreateMappingCommand.create(mappingDomain, originatingInput, object)); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/command/AddOverrideCommand.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/command/SetOverrideCommand.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 7 Number of AST nodes: 7
1
Object object = objects.next();
1
Object object = objects.next();
2
        MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object);
2
        MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object);
3
        Object originatingInput = mappedObjectState.getOriginatingInput();
3
        Object originatingInput = mappedObjectState.getOriginatingInput();
4
 
4
        // This is tricky and is done for each object here rather than once for the owner of the addCommnd.
5
        // This is tricky and is done for each object here rather than once for the owner of the addCommnd.
5
        // We want to make sure the object is really part of the conceptual tree induced by the domain.
6
        // We want to make sure the object is really part of the conceptual tree induced by the domain.
6
        //
7
        //
7
        if (originatingInput == null)
8
        if (originatingInput == null)
8
        {
9
        {
9
          mappedObjectState.setOutput();
10
          mappedObjectState.setOutput();
10
        }
11
        }
11
        else if (mappingRoot.isAttachedObject(object))
12
        else if (mappingRoot.isAttachedObject(object))
12
        {
13
        {
13
          mapOutputObject(object, originatingInput, subcommands);
14
          subcommands.append(CreateMappingCommand.create(mappingDomain,  originatingInput, object));
14
        }
15
        }
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 different classes having the same super class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)25.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    Object object = objects.next();
    6
    Object object = objects.next();
    Preondition Violations
    Unmatched statement Object object=objects.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
                                                                      
    16
    Object object = objects.next();
    Preondition Violations
    Unmatched statement Object object=objects.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    Object object = objects.next();
    7
    MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object);
    17
    MappedObjectState mappedObjectState = mappingRoot.getMappedObjectState(object);
    8
    Object originatingInput = mappedObjectState.getOriginatingInput();
    18
    Object originatingInput = mappedObjectState.getOriginatingInput();
    9
    if (originatingInput == null)
    19
    if (originatingInput == null)
    10
    mappedObjectState.setOutput();
    20
    mappedObjectState.setOutput();
    11
    else if (mappingRoot.isAttachedObject(object))
    21
    else if (mappingRoot.isAttachedObject(object))
    12
    mapOutputObject(object, originatingInput, subcommands);
    12
    mapOutputObject(object, originatingInput, subcommands);
    22
    subcommands.append(CreateMappingCommand.create(mappingDomain, originatingInput, object));
    Differences
    Expression1Expression2Difference
    mapOutputObjectappendMETHOD_INVOCATION_NAME_MISMATCH
    mapOutputObject(object,originatingInput,subcommands)subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object))ARGUMENT_NUMBER_MISMATCH
    subcommandsMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression mapOutputObject(object,originatingInput,subcommands) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mapOutputObject(object,originatingInput,subcommands) is a void method call, and thus it cannot be parameterized
    Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) is a void method call, and thus it cannot be parameterized
    Expression mapOutputObject(object,originatingInput,subcommands) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mapOutputObject(object,originatingInput,subcommands) is a void method call, and thus it cannot be parameterized
    Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) is a void method call, and thus it cannot be parameterized
    22
    subcommands.append(CreateMappingCommand.create(mappingDomain, originatingInput, object));
    Precondition Violations (10)
    Row Violation
    1Unmatched statement Object object=objects.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Object object=objects.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression mapOutputObject(object,originatingInput,subcommands) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression mapOutputObject(object,originatingInput,subcommands) is a void method call, and thus it cannot be parameterized
    6Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) is a void method call, and thus it cannot be parameterized
    7Expression mapOutputObject(object,originatingInput,subcommands) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression mapOutputObject(object,originatingInput,subcommands) is a void method call, and thus it cannot be parameterized
    10Expression subcommands.append(CreateMappingCommand.create(mappingDomain,originatingInput,object)) is a void method call, and thus it cannot be parameterized