Collection<Object> result = new ArrayList<Object>(); for (Command command : commandList) { result.addAll(command.getAffectedObjects()); } return result;
Collection<Object> result = new ArrayList<Object>(); for (Command command : commandList) { result.addAll(command.getResult()); } return result;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/command/CompoundCommand.java File path: /emf-2.4.1/src/org/eclipse/emf/common/command/CompoundCommand.java
Method name: Collection getMergedAffectedObjectsCollection() Method name: Collection getMergedResultCollection()
Number of AST nodes: 4 Number of AST nodes: 4
1
Collection<Object> result = new ArrayList<Object>();
1
Collection<Object> result = new ArrayList<Object>();
2
    for (Command command : commandList)
2
    for (Command command : commandList)
3
    {
3
    {
4
      result.addAll(command.getAffectedObjects());
4
      result.addAll(command.getResult());
5
    }
5
    }
6
    return result;
6
    return result;
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.1
Clones locationClones are declared in the same class
Number of node comparisons8
  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)602.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Collection<Object> result = new ArrayList<Object>();
    1
    Collection<Object> result = new ArrayList<Object>();
    2
    for (Command command : commandList)
    2
    for (Command command : commandList)
    3
    result.addAll(command.getAffectedObjects());
    3
    result.addAll(command.getAffectedObjects());
    3
    result.addAll(command.getResult());
    Differences
    Expression1Expression2Difference
    getAffectedObjectsgetResultMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression command.getAffectedObjects() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression command.getResult() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    result.addAll(command.getResult());
    4
    return result;
    4
    return result;
    Precondition Violations (2)
    Row Violation
    1Expression command.getAffectedObjects() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression command.getResult() cannot be parameterized, because it has dependencies to/from statements that will be extracted