for (int i = 0; i < size; ++i) { Entry entry = entries[i]; if (validator.isValid(entry.getEStructuralFeature())) { if (entry.getValue() == null) { remove(i); return true; } } }
for (int i = 0; i < size; ++i) { Entry entry = entries[i]; if (validator.isValid(entry.getEStructuralFeature())) { if (entry.getValue() == null) { match = entry; break; } ++count; } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
Method name: boolean remove(EStructuralFeature, Object) Method name: NotificationChain basicRemove(EStructuralFeature, Object, NotificationChain)
Number of AST nodes: 6 Number of AST nodes: 7
1
for (int i = 0; i < size; ++i)
1
for (int i = 0; i < size; ++i)
2
      {
2
      {
3
        Entry entry = entries[i];
3
        Entry entry = entries[i];
4
        if (validator.isValid(entry.getEStructuralFeature()))
4
        if (validator.isValid(entry.getEStructuralFeature()))
5
        {
5
        {
6
          if (entry.getValue() == null)
6
          if (entry.getValue() == null)
7
          {
7
          {
8
            remove(i);
8
            match = entry;
9
            return true;
9
            break;
10
          }
10
          }
11
          ++count;
11
        }
12
        }
12
      }
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.9
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    17
    for (int i = 0; i < size; ++i)
    21
    for (int i = 0; i < size; ++i)
    18
    Entry entry = entries[i];
    22
    Entry entry = entries[i];
    19
    if (validator.isValid(entry.getEStructuralFeature()))
    23
    if (validator.isValid(entry.getEStructuralFeature()))
    20
    if (entry.getValue() == null)
    24
    if (entry.getValue() == null)
    21
    remove(i);
    21
    remove(i);
    Preondition Violations
    Unmatched statement remove(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                
    22
    return true;
    22
    return true;
    Preondition Violations
    Unmatched return true;
                                    
                                    
    25
    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
    25
    match = entry;
                        
    26
    break;
    Preondition Violations
    Unmatched break;
    26
    break;
                            
    27
    ++count;
    Preondition Violations
    Unmatched statement ++count; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    27
    ++count;
    Precondition Violations (6)
    Row Violation
    1Unmatched statement remove(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return true;
    3Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched break;
    5Unmatched statement ++count; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Clone fragment #1 returns variable i with type int , while Clone fragment #2 returns variable entry with type org.eclipse.emf.ecore.util.FeatureMap.Entry