if (commandParameter.getEStructuralFeature() != null) { result = createAddCommand (domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection(), commandParameter.getIndex()); } else { result = factorAddCommand(domain, commandParameter); }
if (commandParameter.getEStructuralFeature() != null) { result = createMoveCommand (domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getValue(), commandParameter.getIndex()); } else { result = factorMoveCommand(domain, commandParameter); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/ItemProviderAdapter.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/ItemProviderAdapter.java
Method name: Command createCommand(Object, EditingDomain, Class, CommandParameter) Method name: Command createCommand(Object, EditingDomain, Class, CommandParameter)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (commandParameter.getEStructuralFeature() != null)
1
if (commandParameter.getEStructuralFeature() != null)
2
      {
2
      {
3
        result = 
3
        result = 
4
          createAddCommand
4
          createMoveCommand
5
            (domain, 
5
            (domain, 
6
             commandParameter.getEOwner(), 
6
             commandParameter.getEOwner(), 
7
             commandParameter.getEStructuralFeature(), 
7
             commandParameter.getEStructuralFeature(), 
8
             commandParameter.getCollection(),
8
             commandParameter.getValue(), 
9
             commandParameter.getIndex());
9
             commandParameter.getIndex());
10
      }
10
      }
11
      else
11
      else
12
      {
12
      {
13
        result = factorAddCommand(domain, commandParameter);
13
        result = factorMoveCommand(domain, commandParameter);
14
      }
14
      }
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 statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    if (commandParameter.getEStructuralFeature() != null)
    21
    if (commandParameter.getEStructuralFeature() != null)
    18
    result = createAddCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection(), commandParameter.getIndex());
    18
    result = createAddCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getCollection(), commandParameter.getIndex());
    22
    result = createMoveCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getValue(), commandParameter.getIndex());
    Differences
    Expression1Expression2Difference
    createAddCommandcreateMoveCommandMETHOD_INVOCATION_NAME_MISMATCH
    getCollectiongetValueMETHOD_INVOCATION_NAME_MISMATCH
    java.util.Collectionjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression createAddCommand(domain,commandParameter.getEOwner(),commandParameter.getEStructuralFeature(),commandParameter.getCollection(),commandParameter.getIndex()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression createMoveCommand(domain,commandParameter.getEOwner(),commandParameter.getEStructuralFeature(),commandParameter.getValue(),commandParameter.getIndex()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression commandParameter.getCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression commandParameter.getValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.Collection<> of variable commandParameter.getCollection() does not match with type java.lang.Object of variable commandParameter.getValue()
    • Make classes java.util.Collection and java.lang.Object extend a common superclass
    22
    result = createMoveCommand(domain, commandParameter.getEOwner(), commandParameter.getEStructuralFeature(), commandParameter.getValue(), commandParameter.getIndex());
    else
    else
    19
    result = factorAddCommand(domain, commandParameter);
    19
    result = factorAddCommand(domain, commandParameter);
    23
    result = factorMoveCommand(domain, commandParameter);
    Differences
    Expression1Expression2Difference
    factorAddCommandfactorMoveCommandMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression factorAddCommand(domain,commandParameter) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression factorMoveCommand(domain,commandParameter) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23
    result = factorMoveCommand(domain, commandParameter);
    Precondition Violations (7)
    Row Violation
    1Expression createAddCommand(domain,commandParameter.getEOwner(),commandParameter.getEStructuralFeature(),commandParameter.getCollection(),commandParameter.getIndex()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression createMoveCommand(domain,commandParameter.getEOwner(),commandParameter.getEStructuralFeature(),commandParameter.getValue(),commandParameter.getIndex()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression commandParameter.getCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression commandParameter.getValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.util.Collection<> of variable commandParameter.getCollection() does not match with type java.lang.Object of variable commandParameter.getValue()
    6Expression factorAddCommand(domain,commandParameter) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression factorMoveCommand(domain,commandParameter) cannot be parameterized, because it has dependencies to/from statements that will be extracted