for (Object input : mapping.getInputs()) { MappedObjectState mappedObjectState = getMappedObjectState(input); if (mappedObjectState != null) { mappedObjectState.getMappings().add(mapping); } } for (Object output : mapping.getOutputs()) { MappedObjectState mappedObjectState = getMappedObjectState(output); if (mappedObjectState != null) { mappedObjectState.getMappings().add(mapping); } }
for (Object input : mapping.getInputs()) { MappedObjectState mappedObjectState = getMappedObjectState(input); if (mappedObjectState != null) { mappedObjectState.getMappings().remove(mapping); } } for (Object output : mapping.getOutputs()) { MappedObjectState mappedObjectState = getMappedObjectState(output); if (mappedObjectState != null) { mappedObjectState.getMappings().remove(mapping); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/impl/MappingRootImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/impl/MappingRootImpl.java
Method name: void register(Mapping) Method name: void deregister(Mapping)
Number of AST nodes: 8 Number of AST nodes: 8
1
for (Object input : mapping.getInputs())
1
for (Object input : mapping.getInputs())
2
    {
2
    {
3
      MappedObjectState mappedObjectState = getMappedObjectState(input);
3
      MappedObjectState mappedObjectState = getMappedObjectState(input);
4
      if (mappedObjectState != null)
4
      if (mappedObjectState != null)
5
      {
5
      {
6
        mappedObjectState.getMappings().add(mapping);
6
        mappedObjectState.getMappings().remove(mapping);
7
      }
7
      }
8
    }
8
    }
9
    for (Object output : mapping.getOutputs())
9
    for (Object output : mapping.getOutputs())
10
    {
10
    {
11
      MappedObjectState mappedObjectState = getMappedObjectState(output);
11
      MappedObjectState mappedObjectState = getMappedObjectState(output);
12
      if (mappedObjectState != null)
12
      if (mappedObjectState != null)
13
      {
13
      {
14
        mappedObjectState.getMappings().add(mapping);
14
        mappedObjectState.getMappings().remove(mapping);
15
      }
15
      }
16
    }
16
    }
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.5
Clones locationClones are declared in the same class
Number of node comparisons23
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)24.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (Object input : mapping.getInputs())
    1
    for (Object input : mapping.getInputs())
    2
    MappedObjectState mappedObjectState = getMappedObjectState(input);
    2
    MappedObjectState mappedObjectState = getMappedObjectState(input);
    3
    if (mappedObjectState != null)
    3
    if (mappedObjectState != null)
    4
    mappedObjectState.getMappings().add(mapping);
    4
    mappedObjectState.getMappings().add(mapping);
    4
    mappedObjectState.getMappings().remove(mapping);
    Differences
    Expression1Expression2Difference
    addremoveMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression mappedObjectState.getMappings().add(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappedObjectState.getMappings().remove(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    mappedObjectState.getMappings().remove(mapping);
    5
    for (Object output : mapping.getOutputs())
    5
    for (Object output : mapping.getOutputs())
    6
    MappedObjectState mappedObjectState = getMappedObjectState(output);
    6
    MappedObjectState mappedObjectState = getMappedObjectState(output);
    7
    if (mappedObjectState != null)
    7
    if (mappedObjectState != null)
    8
    mappedObjectState.getMappings().add(mapping);
    8
    mappedObjectState.getMappings().add(mapping);
    8
    mappedObjectState.getMappings().remove(mapping);
    Differences
    Expression1Expression2Difference
    addremoveMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression mappedObjectState.getMappings().add(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression mappedObjectState.getMappings().remove(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    mappedObjectState.getMappings().remove(mapping);
    Precondition Violations (4)
    Row Violation
    1Expression mappedObjectState.getMappings().add(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression mappedObjectState.getMappings().remove(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression mappedObjectState.getMappings().add(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression mappedObjectState.getMappings().remove(mapping) cannot be parameterized, because it has dependencies to/from statements that will be extracted