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"); } }
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())) { 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: void add(int, Entry) Method name: void add(EStructuralFeature, int, Object)
Number of AST nodes: 5 Number of AST nodes: 5
1
FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
1
FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
2
      for (int i = 0, size = delegateSize(); i < size; ++i)
2
      for (int i = 0, size = delegateSize(); i < size; ++i)
3
      {
3
      {
4
        Entry otherEntry = delegateGet(i);
4
        Entry entry = delegateGet(i);
5
        if (validator.isValid(otherEntry.getEStructuralFeature()))
5
        if (validator.isValid(entry.getEStructuralFeature()))
6
        {
6
        {
7
          throw new IllegalArgumentException("The multiplicity constraint is violated");
7
          throw new IllegalArgumentException("The multiplicity constraint is violated");
8
        }
8
        }
9
      }
9
      }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
    8
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);
    5
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
    Differences
    Expression1Expression2Difference
    entryFeaturefeatureVARIABLE_NAME_MISMATCH
    5
    FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), feature);
    9
    for (int i = 0, size = delegateSize(); i < size; ++i)
    6
    for (int i = 0, size = delegateSize(); i < size; ++i)
    10
    Entry otherEntry = delegateGet(i);
    10
    Entry otherEntry = delegateGet(i);
    7
    Entry entry = delegateGet(i);
    Differences
    Expression1Expression2Difference
    otherEntryentryVARIABLE_NAME_MISMATCH
    7
    Entry entry = delegateGet(i);
    11
    if (validator.isValid(otherEntry.getEStructuralFeature()))
    11
    if (validator.isValid(otherEntry.getEStructuralFeature()))
    8
    if (validator.isValid(entry.getEStructuralFeature()))
    Differences
    Expression1Expression2Difference
    otherEntryentryVARIABLE_NAME_MISMATCH
    8
    if (validator.isValid(entry.getEStructuralFeature()))
    12
    throw new IllegalArgumentException("The multiplicity constraint is violated");
    9
    throw new IllegalArgumentException("The multiplicity constraint is violated");
    Precondition Violations (0)
    Row Violation