int pindex = plength; int nindex = index + 1; char ch; do { if ((ch = str.charAt(--index)) != this.pattern[--pindex]) break; if (pindex == 0) return index; } while (pindex > 0); index += this.shiftTable[ch % this.shiftTable.length] + 1; if (index < nindex) index = nindex;
int pindex = plength; int nindex = index + 1; char ch; do { if ((ch = chars[--index]) != this.pattern[--pindex]) break; if (pindex == 0) return index; } while (pindex > 0); index += this.shiftTable[ch % this.shiftTable.length] + 1; if (index < nindex) index = nindex;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
Method name: int matches(String, int, int) Method name: int matches(char[], int, int)
Number of AST nodes: 11 Number of AST nodes: 11
1
int pindex = plength;
1
int pindex = plength;
2
        int nindex = index + 1;
2
        int nindex = index + 1;
3
        char ch;
3
        char ch;
4
        do
4
        do
5
        {
5
        {
6
          if ((ch = str.charAt(--index)) != this.pattern[--pindex])
6
          if ((ch = chars[--index]) != this.pattern[--pindex])
7
            break;
7
            break;
8
          if (pindex == 0)
8
          if (pindex == 0)
9
            return index;
9
            return index;
10
        }
10
        }
11
        while (pindex > 0);
11
        while (pindex > 0);
12
        index += this.shiftTable[ch % this.shiftTable.length] + 1;
12
        index += this.shiftTable[ch % this.shiftTable.length] + 1;
13
        if (index < nindex)
13
        if (index < nindex)
14
          index = nindex;
14
          index = nindex;
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.6
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    int pindex = plength;
    8
    int pindex = plength;
    9
    int nindex = index + 1;
    9
    int nindex = index + 1;
    10
    char ch;
    10
    char ch;
    15
    do while(pindex > 0)
    15
    do while(pindex > 0)
    11
    if ((ch = str.charAt(--index)) != this.pattern[--pindex])
    11
    if ((ch = str.charAt(--index)) != this.pattern[--pindex])
    11
    if ((ch = chars[--index]) != this.pattern[--pindex])
    Differences
    Expression1Expression2Difference
    str.charAt(--index)chars[--index]TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression str.charAt(--index) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression chars[--index] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    if ((ch = chars[--index]) != this.pattern[--pindex])
    12
    break;
    12
    break;
    13
    if (pindex == 0)
    13
    if (pindex == 0)
    14
    return index;
    14
    return index;
    16
    index += this.shiftTable[ch % this.shiftTable.length] + 1;
    16
    index += this.shiftTable[ch % this.shiftTable.length] + 1;
    17
    if (index < nindex)
    17
    if (index < nindex)
    18
    index = nindex;
    18
    index = nindex;
    Precondition Violations (2)
    Row Violation
    1Expression str.charAt(--index) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression chars[--index] cannot be parameterized, because it has dependencies to/from statements that will be extracted