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: 19 | Number of AST nodes: 19 | |||
1 | if (this.ignoreCase)↵ | 1 | if (this.ignoreCase)↵ | |
2 | return this.matchesIgnoreCase(iterator, start, limit);↵ | 2 | return this.matchesIgnoreCase(str, start, limit);↵ | |
3 | int plength = this.pattern.length;↵ | 3 | int plength = this.pattern.length;↵ | |
4 | if (plength == 0)↵ | 4 | if (plength == 0)↵ | |
5 | return start;↵ | 5 | return start;↵ | |
6 | int index = start + plength;↵ | 6 | int index = start + plength;↵ | |
7 | while (index <= limit)↵ | 7 | while (index <= limit)↵ | |
8 | {↵ | 8 | {↵ | |
9 | //System.err.println("Starts at "+index);↵ | |||
9 | int pindex = plength;↵ | 10 | int pindex = plength;↵ | |
10 | int nindex = index + 1;↵ | 11 | int nindex = index + 1;↵ | |
11 | char ch;↵ | 12 | char ch;↵ | |
12 | do↵ | 13 | do↵ | |
13 | {↵ | 14 | {↵ | |
14 | if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex])↵ | 15 | if ((ch = str.charAt(--index)) != this.pattern[--pindex])↵ | |
15 | break;↵ | 16 | break;↵ | |
16 | if (pindex == 0)↵ | 17 | if (pindex == 0)↵ | |
17 | return index;↵ | 18 | return index;↵ | |
18 | }↵ | 19 | }↵ | |
19 | while (pindex > 0);↵ | 20 | while (pindex > 0);↵ | |
20 | index += this.shiftTable[ch % this.shiftTable.length] + 1;↵ | 21 | index += this.shiftTable[ch % this.shiftTable.length] + 1;↵ | |
21 | if (index < nindex)↵ | 22 | if (index < nindex)↵ | |
22 | index = nindex;↵ | 23 | index = nindex;↵ | |
23 | }↵ | 24 | }↵ | |
24 | return -1; | 25 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 56 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 2.5 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (this.ignoreCase) | 1 | if (this.ignoreCase) | |||||||||||||||
2 | return this.matchesIgnoreCase(iterator, start, limit); |
| 2 | return this.matchesIgnoreCase(str, start, limit); | ||||||||||||||
3 | int plength = this.pattern.length; | 3 | int plength = this.pattern.length; | |||||||||||||||
4 | if (plength == 0) | 4 | if (plength == 0) | |||||||||||||||
5 | return start; | 5 | return start; | |||||||||||||||
6 | int index = start + plength; | 6 | int index = start + plength; | |||||||||||||||
7 | while (index <= limit) | 7 | while (index <= limit) | |||||||||||||||
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]) | |||||||||||||||
|
| 12 | break; | |||||||||||||||
11 | if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex]) |
| | |||||||||||||||
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; |
Row | Violation |
---|---|
1 | Type java.text.CharacterIterator of variable iterator does not match with type java.lang.String of variable str |
2 | 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 |
3 | Unmatched break; |
4 | 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 |
5 | Unmatched break; |
6 | Clone fragment #1 returns variables index, pindex, ch , while Clone fragment #2 returns variables index, pindex, ch |