for (int i = 0, size = delegateSize(); i < size; ++i) { Entry entry = delegateGet(i); if (validator.isValid(entry.getEStructuralFeature())) { if (entry.equals(object)) { result = count; } ++count; } }
for (int i = 0, size = delegateSize(); i < size; ++i) { Entry entry = delegateGet(i); if (validator.isValid(entry.getEStructuralFeature())) { if (entry.equals(object)) { match = entry; break; } ++count; } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
Method name: int lastIndexOf(EStructuralFeature, Object, boolean) Method name: NotificationChain basicRemove(EStructuralFeature, Object, NotificationChain)
Number of AST nodes: 6 Number of AST nodes: 7
1
for (int i = 0, size = delegateSize(); i < size; ++i)
1
for (int i = 0, size = delegateSize(); i < size; ++i)
2
      {
2
      {
3
        Entry entry = delegateGet(i);
3
        Entry entry = delegateGet(i);
4
        if (validator.isValid(entry.getEStructuralFeature()))
4
        if (validator.isValid(entry.getEStructuralFeature()))
5
        {
5
        {
6
          if (entry.equals(object))
6
          if (entry.equals(object))
7
          {
7
          {
8
            result = count
8
            match = entry;
9
;
9
            break;
10
          }
10
          }
11
          ++count;
11
          ++count;
12
        }
12
        }
13
      }
13
      }
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.4
Clones locationClones are declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0, size = delegateSize(); i < size; ++i)
    5
    for (int i = 0, size = delegateSize(); i < size; ++i)
    6
    Entry entry = delegateGet(i);
    6
    Entry entry = delegateGet(i);
    7
    if (validator.isValid(entry.getEStructuralFeature()))
    7
    if (validator.isValid(entry.getEStructuralFeature()))
    8
    if (entry.equals(object))
    8
    if (entry.equals(object))
                                  
    9
    match = entry;
    Preondition Violations
    Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    match = entry;
    9
    result = count;
    9
    result = count;
    Preondition Violations
    Unmatched statement result=count; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
                        
    10
    break;
    Preondition Violations
    Unmatched break;
    10
    break;
    10
    ++count;
    11
    ++count;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement result=count; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched break;
    4Clone fragment #1 returns variables count , while Clone fragment #2 returns variables entry, count