int plength = this.pattern.length; if (plength == 0) return start; int index = start + plength; while (index <= limit) { int pindex = plength; int nindex = index + 1; char ch; do { char ch1 = ch = iterator.setIndex(--index); char ch2 = this.pattern[--pindex]; if (ch1 != ch2) { ch1 = Character.toUpperCase(ch1); ch2 = Character.toUpperCase(ch2); if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) break; } if (pindex == 0) return index; } while (pindex > 0); index += this.shiftTable[ch % this.shiftTable.length] + 1; if (index < nindex) index = nindex; } return -1;
int plength = this.pattern.length; if (plength == 0) return start; int index = start + plength; while (index <= limit) { int pindex = plength; int nindex = index + 1; char ch; do { char ch1 = ch = text.charAt(--index); char ch2 = this.pattern[--pindex]; if (ch1 != ch2) { ch1 = Character.toUpperCase(ch1); ch2 = Character.toUpperCase(ch2); if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) break; } if (pindex == 0) return index; } while (pindex > 0); index += this.shiftTable[ch % this.shiftTable.length] + 1; if (index < nindex) index = nindex; } return -1;
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 matchesIgnoreCase(CharacterIterator, int, int) Method name: int matchesIgnoreCase(String, int, int)
Number of AST nodes: 22 Number of AST nodes: 22
1
int plength = this.pattern.length;
1
int plength = this.pattern.length;
2
      if (plength == 0)
2
      if (plength == 0)
3
        return start;
3
        return start;
4
      int index = start + plength;
4
      int index = start + plength;
5
      while (index <= limit)
5
      while (index <= limit)
6
      {
6
      {
7
        int pindex = plength;
7
        int pindex = plength;
8
        int nindex = index + 1;
8
        int nindex = index + 1;
9
        char ch;
9
        char ch;
10
        do
10
        do
11
        {
11
        {
12
          char ch1 = ch = iterator.setIndex(--index);
12
          char ch1 = ch = text.charAt(--index);
13
          char ch2 = this.pattern[--pindex];
13
          char ch2 = this.pattern[--pindex];
14
          if (ch1 != ch2)
14
          if (ch1 != ch2)
15
          {
15
          {
16
            ch1 = Character.toUpperCase(ch1);
16
            ch1 = Character.toUpperCase(ch1);
17
            ch2 = Character.toUpperCase(ch2);
17
            ch2 = Character.toUpperCase(ch2);
18
            if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
18
            if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
19
              break;
19
              break;
20
          }
20
          }
21
          if (pindex == 0)
21
          if (pindex == 0)
22
            return index;
22
            return index;
23
        }
23
        }
24
        while (pindex > 0);
24
        while (pindex > 0);
25
        index += this.shiftTable[ch % this.shiftTable.length] + 1;
25
        index += this.shiftTable[ch % this.shiftTable.length] + 1;
26
        if (index < nindex)
26
        if (index < nindex)
27
          index = nindex;
27
          index = nindex;
28
      }
28
      }
29
      return -1;
29
      return -1;
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 comparisons70
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements21
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int plength = this.pattern.length;
    1
    int plength = this.pattern.length;
    2
    if (plength == 0)
    2
    if (plength == 0)
    3
    return start;
    3
    return start;
    4
    int index = start + plength;
    4
    int index = start + plength;
    5
    while (index <= limit)
    5
    while (index <= limit)
    6
    int pindex = plength;
    6
    int pindex = plength;
    7
    int nindex = index + 1;
    7
    int nindex = index + 1;
    8
    char ch;
    8
    char ch;
    18
    do while(pindex > 0)
    18
    do while(pindex > 0)
                                                                            
    9
    char ch1 = ch = text.charAt(--index);
    Preondition Violations
    Unmatched statement char ch1=ch=text.charAt(--index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    char ch1 = ch = text.charAt(--index);
    9
    char ch1 = ch = iterator.setIndex(--index);
    9
    char ch1 = ch = iterator.setIndex(--index);
    Preondition Violations
    Unmatched statement char ch1=ch=iterator.setIndex(--index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    10
    char ch2 = this.pattern[--pindex];
    10
    char ch2 = this.pattern[--pindex];
    11
    if (ch1 != ch2)
    11
    if (ch1 != ch2)
    12
    ch1 = Character.toUpperCase(ch1);
    12
    ch1 = Character.toUpperCase(ch1);
    13
    ch2 = Character.toUpperCase(ch2);
    13
    ch2 = Character.toUpperCase(ch2);
    14
    if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
    14
    if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
    15
    break;
    15
    break;
    16
    if (pindex == 0)
    16
    if (pindex == 0)
    17
    return index;
    17
    return index;
    19
    index += this.shiftTable[ch % this.shiftTable.length] + 1;
    19
    index += this.shiftTable[ch % this.shiftTable.length] + 1;
    20
    if (index < nindex)
    20
    if (index < nindex)
    21
    index = nindex;
    21
    index = nindex;
    22
    return -1;
    22
    return -1;
    Precondition Violations (3)
    Row Violation
    1Unmatched statement char ch1=ch=text.charAt(--index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement char ch1=ch=iterator.setIndex(--index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables index, ch , while Clone fragment #2 returns variables index, ch