if (commandList.isEmpty()) { return Collections.EMPTY_LIST; } else if (resultIndex == LAST_COMMAND_ALL) { return commandList.get(commandList.size() - 1).getResult(); } else if (resultIndex == MERGE_COMMAND_ALL) { return getMergedResultCollection(); } else if (resultIndex < commandList.size()) { return commandList.get(resultIndex).getResult(); } else { return Collections.EMPTY_LIST; }
if (commandList.isEmpty()) { return Collections.EMPTY_LIST; } else if (resultIndex == LAST_COMMAND_ALL) { return commandList.get(commandList.size() - 1).getAffectedObjects(); } else if (resultIndex == MERGE_COMMAND_ALL) { return getMergedAffectedObjectsCollection(); } else if (resultIndex < commandList.size()) { return commandList.get(resultIndex).getAffectedObjects(); } else { return Collections.EMPTY_LIST; }
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 getResult() Method name: Collection getAffectedObjects()
Number of AST nodes: 9 Number of AST nodes: 9
1
if (commandList.isEmpty())
1
if (commandList.isEmpty())
2
    {
2
    {
3
      return Collections.EMPTY_LIST;
3
      return Collections.EMPTY_LIST;
4
    }
4
    }
5
    else if (resultIndex == LAST_COMMAND_ALL)
5
    else if (resultIndex == LAST_COMMAND_ALL)
6
    {
6
    {
7
      return commandList.get(commandList.size() - 1).getResult();
7
      return commandList.get(commandList.size() - 1).getAffectedObjects();
8
    }
8
    }
9
    else if (resultIndex == MERGE_COMMAND_ALL)
9
    else if (resultIndex == MERGE_COMMAND_ALL)
10
    {
10
    {
11
      return getMergedResultCollection();
11
      return getMergedAffectedObjectsCollection();
12
    }
12
    }
13
    else if (resultIndex < commandList.size())
13
    else if (resultIndex < commandList.size())
14
    {
14
    {
15
      return commandList.get(resultIndex).getResult();
15
      return commandList.get(resultIndex).getAffectedObjects();
16
    }
16
    }
17
    else
17
    else
18
    {
18
    {
19
      return Collections.EMPTY_LIST;
19
      return Collections.EMPTY_LIST;
20
    }
20
    }
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.7
Clones locationClones are declared in the same class
Number of node comparisons57
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (commandList.isEmpty())
    1
    if (commandList.isEmpty())
    2
    return Collections.EMPTY_LIST;
    2
    return Collections.EMPTY_LIST;
    3
    else if (resultIndex == LAST_COMMAND_ALL)
    3
    else if (resultIndex == LAST_COMMAND_ALL)
    4
    return commandList.get(commandList.size() - 1).getResult();
    4
    return commandList.get(commandList.size() - 1).getResult();
    4
    return commandList.get(commandList.size() - 1).getAffectedObjects();
    Differences
    Expression1Expression2Difference
    getResultgetAffectedObjectsMETHOD_INVOCATION_NAME_MISMATCH
    4
    return commandList.get(commandList.size() - 1).getAffectedObjects();
    5
    else if (resultIndex == MERGE_COMMAND_ALL)
    5
    else if (resultIndex == MERGE_COMMAND_ALL)
    6
    return getMergedResultCollection();
    6
    return getMergedResultCollection();
    6
    return getMergedAffectedObjectsCollection();
    Differences
    Expression1Expression2Difference
    getMergedResultCollectiongetMergedAffectedObjectsCollectionMETHOD_INVOCATION_NAME_MISMATCH
    6
    return getMergedAffectedObjectsCollection();
    7
    else if (resultIndex < commandList.size())
    7
    else if (resultIndex < commandList.size())
    8
    return commandList.get(resultIndex).getResult();
    8
    return commandList.get(resultIndex).getResult();
    8
    return commandList.get(resultIndex).getAffectedObjects();
    Differences
    Expression1Expression2Difference
    getResultgetAffectedObjectsMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression commandList.get(resultIndex).getResult() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression commandList.get(resultIndex).getAffectedObjects() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    return commandList.get(resultIndex).getAffectedObjects();
    else
    else
    9
    return Collections.EMPTY_LIST;
    9
    return Collections.EMPTY_LIST;
    Precondition Violations (2)
    Row Violation
    1Expression commandList.get(resultIndex).getResult() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression commandList.get(resultIndex).getAffectedObjects() cannot be parameterized, because it has dependencies to/from statements that will be extracted