max = ch -'0'; // {min,max}
while (off < this.regexlen
&& (ch = this.regex.charAt(off++)) >= '0'
&& ch <= '9') {
max = max*10 +ch-'0';
if (max < 0)
throw ex("parser.quantifier.5", this.offset);
}
if (min > max)
throw ex("parser.quantifier.4", this.offset);
min = ch -'0';
while (off < this.regexlen
&& (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') {
min = min*10 +ch-'0';
if (min < 0)
throw ex("parser.quantifier.5", this.offset);
}
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: Token parseFactor()
|
|
Method name: Token parseFactor()
|
Number of AST nodes: 7
|
|
Number of AST nodes: 5
|
|
1 | max = ch -'0'; // {min,max}↵ | | 1 | min = ch -'0';↵
|
2 | ↵ | | |
|
3 | while (off < this.regexlen↵ | | 2 | while (off < this.regexlen↵
|
4 | && (ch = this.regex.charAt(off++)) >= '0'↵ | | 3 | && (ch = this.regex.charAt(off++)) >= '0'↵
|
5 | && ch <= '9') {↵ | | 4 | && ch <= '9') {↵
|
6 | max = max*10 +ch-'0';↵ | | 5 | min = min*10 +ch-'0';↵
|
7 | if (max < 0)↵ | | 6 | if (min < 0)↵
|
8 | throw ex("parser.quantifier.5", this.offset);↵ | | 7 | throw ex("parser.quantifier.5", this.offset);↵
|
9 | }↵ | | 8 | ↵
|
|
10 | if (min > max)↵ | | |
|
11 | throw ex("parser.quantifier.4", this.offset); | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
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) | 0.7 |
Clones location | Clones are in the same method |
Number of node comparisons | 10 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
60 | max = ch - '0'; | | 49 | min = ch - '0'; |
61 | while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') | | 50 | while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') |
62 | max = max * 10 + ch - '0'; | | 51 | min = min * 10 + ch - '0'; |
63 | | | 52 | |
64 | throw ex("parser.quantifier.5", this.offset); | | 53 | throw ex("parser.quantifier.5", this.offset); |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables max, ch, off , while Clone fragment #2 returns variables min, ch, off |