if (name.length() == 0) return false; char ch = name.charAt(0); if( isNameStart(ch) == false) return false; for (int i = 1; i < name.length(); i++ ) { ch = name.charAt(i); if( isName( ch ) == false ){ return false; } } return true;
if (ncName.length() == 0) return false; char ch = ncName.charAt(0); if( isNCNameStart(ch) == false) return false; for (int i = 1; i < ncName.length(); i++ ) { ch = ncName.charAt(i); if( isNCName( ch ) == false ){ return false; } } return true;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java
Method name: boolean isValidName(String) Method name: boolean isValidNCName(String)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (name.length() == 0)
1
if (ncName.length() == 0)
2
             return false;
2
             return false;
3
         char ch = name.charAt(0);
3
         char ch = ncName.charAt(0);
4
         if( isNameStart(ch) == false)
4
         if( isNCNameStart(ch) == false)
5
            return false;
5
            return false;
6
         for (int i = 1; i < name.length(); i++ ) {
6
         for (int i = 1; i < ncName.length(); i++ ) {
7
            ch = name.charAt(i);
7
            ch = ncName.charAt(i);
8
            if( isName( ch ) == false ){
8
            if( isNCName( ch ) == false ){
9
               return false;
9
               return false;
10
            }
10
            }
11
         }
11
         }
12
         return true;
12
         return true;
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 comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (name.length() == 0)
    1
    if (name.length() == 0)
    1
    if (ncName.length() == 0)
    Differences
    Expression1Expression2Difference
    namencNameVARIABLE_NAME_MISMATCH
    1
    if (ncName.length() == 0)
    2
    return false;
    2
    return false;
    3
    char ch = name.charAt(0);
    3
    char ch = name.charAt(0);
    3
    char ch = ncName.charAt(0);
    Differences
    Expression1Expression2Difference
    namencNameVARIABLE_NAME_MISMATCH
    3
    char ch = ncName.charAt(0);
    4
    if (isNameStart(ch) == false)
    4
    if (isNameStart(ch) == false)
    4
    if (isNCNameStart(ch) == false)
    Differences
    Expression1Expression2Difference
    isNameStartisNCNameStartMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression isNameStart(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression isNCNameStart(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (isNCNameStart(ch) == false)
    5
    return false;
    5
    return false;
    6
    for (int i = 1; i < name.length(); i++)
    6
    for (int i = 1; i < name.length(); i++)
    6
    for (int i = 1; i < ncName.length(); i++)
    Differences
    Expression1Expression2Difference
    namencNameVARIABLE_NAME_MISMATCH
    6
    for (int i = 1; i < ncName.length(); i++)
    7
    ch = name.charAt(i);
    7
    ch = name.charAt(i);
    7
    ch = ncName.charAt(i);
    Differences
    Expression1Expression2Difference
    namencNameVARIABLE_NAME_MISMATCH
    7
    ch = ncName.charAt(i);
    8
    if (isName(ch) == false)
    8
    if (isName(ch) == false)
    8
    if (isNCName(ch) == false)
    Differences
    Expression1Expression2Difference
    isNameisNCNameMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression isName(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression isNCName(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (isNCName(ch) == false)
    9
    return false;
    9
    return false;
    10
    return true;
    10
    return true;
    Precondition Violations (4)
    Row Violation
    1Expression isNameStart(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression isNCNameStart(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression isName(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression isNCName(ch) cannot be parameterized, because it has dependencies to/from statements that will be extracted