for (int i = 0; i < nodes.size(); i++) { RoseNode node = nodes.get(i); if (key.equals(node.getKey())) { return node; } } return null;
for (int i = 0; i < nodes.size(); i++) { RoseNode node = nodes.get(i); if (value.equals(node.getValue())) { return node; } } return null;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/importer/rose/parser/RoseNode.java File path: /emf-2.4.1/src/org/eclipse/emf/importer/rose/parser/RoseNode.java
Method name: RoseNode findNodeWithKey(String) Method name: RoseNode findNodeWithValue(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int i = 0; i < nodes.size(); i++)
1
for (int i = 0; i < nodes.size(); i++)
2
    {
2
    {
3
      RoseNode node = nodes.get(i);
3
      RoseNode node = nodes.get(i);
4
      if (key.equals(node.getKey()))
4
      if (value.equals(node.getValue()))
5
      {
5
      {
6
        return node;
6
        return node;
7
      }
7
      }
8
    }
8
    }
9
    return null;
9
    return null;
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 declared in the same class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < nodes.size(); i++)
    1
    for (int i = 0; i < nodes.size(); i++)
    2
    RoseNode node = nodes.get(i);
    2
    RoseNode node = nodes.get(i);
    3
    if (key.equals(node.getKey()))
    3
    if (key.equals(node.getKey()))
    3
    if (value.equals(node.getValue()))
    Differences
    Expression1Expression2Difference
    getKeygetValueMETHOD_INVOCATION_NAME_MISMATCH
    keyvalueVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression node.getKey() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression node.getValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (value.equals(node.getValue()))
    4
    return node;
    4
    return node;
    5
    return null;
    5
    return null;
    Precondition Violations (2)
    Row Violation
    1Expression node.getKey() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression node.getValue() cannot be parameterized, because it has dependencies to/from statements that will be extracted