boolean result = true; for (Iterator<?> i = idrefsBase.iterator(); i.hasNext() && (result || diagnostics != null); ) { Object item = i.next(); if (XMLTypePackage.Literals.IDREF.isInstance(item)) { result &= validateIDREF((String)item, diagnostics, context); } else { result = false; reportDataValueTypeViolation(XMLTypePackage.Literals.IDREF, item, diagnostics, context); } } return result;
boolean result = true; for (Iterator<?> i = nmtokensBase.iterator(); i.hasNext() && (result || diagnostics != null); ) { Object item = i.next(); if (XMLTypePackage.Literals.NMTOKEN.isInstance(item)) { result &= validateNMTOKEN((String)item, diagnostics, context); } else { result = false; reportDataValueTypeViolation(XMLTypePackage.Literals.NMTOKEN, item, diagnostics, context); } } return result;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/util/XMLTypeValidator.java
Method name: boolean validateIDREFSBase_ItemType(List, DiagnosticChain, Map) Method name: boolean validateNMTOKENSBase_ItemType(List, DiagnosticChain, Map)
Number of AST nodes: 8 Number of AST nodes: 8
1
boolean result = true;
1
boolean result = true;
2
    for (Iterator<?> i = idrefsBase.iterator(); i.hasNext() && (result || diagnostics != null); )
2
    for (Iterator<?> i = nmtokensBase.iterator(); i.hasNext() && (result || diagnostics != null); )
3
    {
3
    {
4
      Object item = i.next();
4
      Object item = i.next();
5
      if (XMLTypePackage.Literals.IDREF.isInstance(item))
5
      if (XMLTypePackage.Literals.NMTOKEN.isInstance(item))
6
      {
6
      {
7
        result &= validateIDREF((String)item, diagnostics, context);
7
        result &= validateNMTOKEN((String)item, diagnostics, context);
8
      }
8
      }
9
      else
9
      else
10
      {
10
      {
11
        result = false;
11
        result = false;
12
        reportDataValueTypeViolation(XMLTypePackage.Literals.IDREF, item, diagnostics, context);
12
        reportDataValueTypeViolation(XMLTypePackage.Literals.NMTOKEN, item, diagnostics, context);
13
      }
13
      }
14
    }
14
    }
15
    return result;
15
    return result;
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.5
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)45.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                    
    3
    Object item = i.next();
    Preondition Violations
    Unmatched statement Object item=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    Object item = i.next();
    3
    Object item = i.next();
    3
    Object item = i.next();
    Preondition Violations
    Unmatched statement Object item=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    4
    if (XMLTypePackage.Literals.IDREF.isInstance(item))
    4
    if (XMLTypePackage.Literals.IDREF.isInstance(item))
    4
    if (XMLTypePackage.Literals.NMTOKEN.isInstance(item))
    Differences
    Expression1Expression2Difference
    IDREFNMTOKENVARIABLE_NAME_MISMATCH
    4
    if (XMLTypePackage.Literals.NMTOKEN.isInstance(item))
    5
    result &= validateIDREF((String)item, diagnostics, context);
    5
    result &= validateIDREF((String)item, diagnostics, context);
    5
    result &= validateNMTOKEN((String)item, diagnostics, context);
    Differences
    Expression1Expression2Difference
    validateIDREFvalidateNMTOKENMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression validateIDREF((String)item,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression validateNMTOKEN((String)item,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    result &= validateNMTOKEN((String)item, diagnostics, context);
    else
    else
    6
    result = false;
    6
    result = false;
    7
    reportDataValueTypeViolation(XMLTypePackage.Literals.IDREF, item, diagnostics, context);
    7
    reportDataValueTypeViolation(XMLTypePackage.Literals.IDREF, item, diagnostics, context);
    7
    reportDataValueTypeViolation(XMLTypePackage.Literals.NMTOKEN, item, diagnostics, context);
    Differences
    Expression1Expression2Difference
    IDREFNMTOKENVARIABLE_NAME_MISMATCH
    7
    reportDataValueTypeViolation(XMLTypePackage.Literals.NMTOKEN, item, diagnostics, context);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement Object item=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Object item=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression validateIDREF((String)item,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression validateNMTOKEN((String)item,diagnostics,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted