FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature); for (int i = 0, size = delegateSize(); i < size; ++i) { Entry entry = delegateGet(i); if (validator.isValid(entry.getEStructuralFeature())) { return false; } } return true;
FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature); for (int i = 0, size = delegateSize(); i < size; ++i) { Entry otherEntry = delegateGet(i); if (validator.isValid(otherEntry.getEStructuralFeature())) { throw new IllegalArgumentException("The multiplicity constraint is violated"); } }
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: boolean isEmpty(EStructuralFeature) Method name: void add(int, Entry)
Number of AST nodes: 6 Number of AST nodes: 5
1
FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
1
FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
2
    for (int i = 0, size = delegateSize(); i < size; ++i)
2
      for (int i = 0, size = delegateSize(); i < size; ++i)
3
    {
3
    
4
  {
4
      Entry entry = delegateGet(i);
5
        Entry otherEntry = delegateGet(i);
5
      if (validator.isValid(entry.getEStructuralFeature()))
6
        if (validator.isValid(otherEntry.getEStructuralFeature()))
6
      {
7
        {
7
        return false;
8
          throw new IllegalArgumentException("The multiplicity constraint is violated");
8
      }
9
     
9
    }
10
   }
10
    return true;
11
      }
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 comparisons10
  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 fragment1
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
    1
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
    8
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
    Differences
    Expression1Expression2Difference
    featureentryFeatureVARIABLE_NAME_MISMATCH
    8
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
    2
    for (int i = 0, size = delegateSize(); i < size; ++i)
    9
    for (int i = 0, size = delegateSize(); i < size; ++i)
    3
    Entry entry = delegateGet(i);
    3
    Entry entry = delegateGet(i);
    10
    Entry otherEntry = delegateGet(i);
    Differences
    Expression1Expression2Difference
    entryotherEntryVARIABLE_NAME_MISMATCH
    10
    Entry otherEntry = delegateGet(i);
    4
    if (validator.isValid(entry.getEStructuralFeature()))
    4
    if (validator.isValid(entry.getEStructuralFeature()))
    11
    if (validator.isValid(otherEntry.getEStructuralFeature()))
    Differences
    Expression1Expression2Difference
    entryotherEntryVARIABLE_NAME_MISMATCH
    11
    if (validator.isValid(otherEntry.getEStructuralFeature()))
    5
    return false;
    5
    return false;
    Preondition Violations
    Unmatched return false;
                                    
                                                                                                                                                                        
    12
    throw new IllegalArgumentException("The multiplicity constraint is violated");
    Preondition Violations
    Unmatched throw new IllegalArgumentException("The multiplicity constraint is violated");
    12
    throw new IllegalArgumentException("The multiplicity constraint is violated");
    6
    return true;
    6
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    Precondition Violations (3)
    Row Violation
    1Unmatched return false;
    2Unmatched throw new IllegalArgumentException("The multiplicity constraint is violated");
    3Unmatched return true;