int pindex = plength; int nindex = index + 1; char ch; do { if ((ch = iterator.setIndex(--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 = 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;
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(CharacterIterator, int, int) Method name: int matches(String, 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 = iterator.setIndex(--index)) != this.pattern[--pindex])
6
          if ((ch = str.charAt(--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 comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 3
    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])
    Preondition Violations
    Unmatched statement if((ch=str.charAt(--index)) != this.pattern[--pindex]) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    if ((ch = str.charAt(--index)) != this.pattern[--pindex])
                        
    12
    break;
    Preondition Violations
    Unmatched break;
    12
    break;
    11
    if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex])
    11
    if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex])
    Preondition Violations
    Unmatched statement if((ch=iterator.setIndex(--index)) != this.pattern[--pindex]) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                      
    12
    break;
    12
    break;
    Preondition Violations
    Unmatched 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 (5)
    Row Violation
    1Unmatched statement if((ch=str.charAt(--index)) != this.pattern[--pindex]) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched break;
    3Unmatched statement if((ch=iterator.setIndex(--index)) != this.pattern[--pindex]) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched break;
    5Clone fragment #1 returns variables index, pindex, ch , while Clone fragment #2 returns variables index, pindex, ch