List<EReference> eAllReferences = eClass.getEAllReferences(); for (int i = 0, size = eAllReferences.size(); i < size; ++i) { EReference eReference = eAllReferences.get(i); if ("xmlns:prefix".equals(getName(eReference))) { return eReference; } }
List<EStructuralFeature> allElements = getAllElements(eClass); for (int i = 0, size = allElements.size(); i < size; ++i) { EStructuralFeature result = allElements.get(i); if (matches(getWildcards(result), namespace)) { return result; } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java
Method name: EReference getXMLNSPrefixMapFeature(EClass) Method name: EStructuralFeature getAffiliation(EClass, EStructuralFeature)
Number of AST nodes: 5 Number of AST nodes: 5
1
List<EReference> eAllReferences = eClass.getEAllReferences();
1
List<EStructuralFeature> allElements = getAll
2
Elements(eClass);
2
      for (int i = 0, size = eAllReferences.size();  i < size; ++i)
3
          for (int i = 0, size = allElements.size(); i < size; ++i)
3
      {
4
          {
4
        EReference eReference = eAllReferences.get(i);
5
            EStructuralFeature result = allElements.get(i);
5
        if ("xmlns:prefix".equals(getName(eReference)))
6
            if (matches(getWildcards(result), namespace))
6
        {
7
          
8
  {
7
          return eReference;
9
              return 
8
        }
10
result;
11
            }
9
      }
12
          }
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 statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)10.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    List<EReference> eAllReferences = eClass.getEAllReferences();
                                                                                                                                
                                                                                                                                    
    26
    List<EStructuralFeature> allElements = getAllElements(eClass);
    3
    for (int i = 0, size = eAllReferences.size(); i < size; ++i)
    3
    for (int i = 0, size = eAllReferences.size(); i < size; ++i)
    27
    for (int i = 0, size = allElements.size(); i < size; ++i)
    Differences
    Expression1Expression2Difference
    eAllReferencesallElementsVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List<org.eclipse.emf.ecore.EReference> of variable eAllReferences does not match with type java.util.List<org.eclipse.emf.ecore.EStructuralFeature> of variable allElements
    • Make classes java.util.List and java.util.List extend a common superclass
    27
    for (int i = 0, size = allElements.size(); i < size; ++i)
    4
    EReference eReference = eAllReferences.get(i);
    4
    EReference eReference = eAllReferences.get(i);
    Preondition Violations
    Unmatched statement EReference eReference=eAllReferences.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
                                                                                                      
    28
    EStructuralFeature result = allElements.get(i);
    Preondition Violations
    Unmatched statement EStructuralFeature result=allElements.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    28
    EStructuralFeature result = allElements.get(i);
    5
    if ("xmlns:prefix".equals(getName(eReference)))
    5
    if ("xmlns:prefix".equals(getName(eReference)))
    29
    if (matches(getWildcards(result), namespace))
    Differences
    Expression1Expression2Difference
    equalsmatchesMETHOD_INVOCATION_NAME_MISMATCH
    "xmlns:prefix".equals(getName(eReference))matches(getWildcards(result),namespace)ARGUMENT_NUMBER_MISMATCH
    "xmlns:prefix"MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression "xmlns:prefix".equals(getName(eReference)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression matches(getWildcards(result),namespace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression "xmlns:prefix".equals(getName(eReference)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression matches(getWildcards(result),namespace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29
    if (matches(getWildcards(result), namespace))
    6
    return eReference;
    6
    return eReference;
    Preondition Violations
    Unmatched return eReference;
                                              
                                        
    30
    return result;
    Preondition Violations
    Unmatched return result;
    30
    return result;
    Precondition Violations (9)
    Row Violation
    1Type java.util.List<org.eclipse.emf.ecore.EReference> of variable eAllReferences does not match with type java.util.List<org.eclipse.emf.ecore.EStructuralFeature> of variable allElements
    2Unmatched statement EReference eReference=eAllReferences.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement EStructuralFeature result=allElements.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression "xmlns:prefix".equals(getName(eReference)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression matches(getWildcards(result),namespace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression "xmlns:prefix".equals(getName(eReference)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression matches(getWildcards(result),namespace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Unmatched return eReference;
    9Unmatched return result;