if (isSet(opts, IGNORE_CASE)) {
int ch = op.getData();
if (dx > 0) {
if (offset >= con.limit || !matchIgnoreCase(ch, target .charAt( offset ) ))
return -1;
offset ++;
} else {
int o1 = offset-1;
if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .charAt( o1 ) ))
return -1;
offset = o1;
}
} else {
int ch = op.getData();
if (dx > 0) {
if (offset >= con.limit || ch != target .charAt( offset ) )
return -1;
offset ++;
} else {
int o1 = offset-1;
if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) )
return -1;
offset = o1;
}
}
if (isSet(opts, IGNORE_CASE)) {
int ch = op.getData();
if (dx > 0) {
if (offset >= con.limit || !matchIgnoreCase(ch, target .setIndex( offset ) ))
return -1;
offset ++;
} else {
int o1 = offset-1;
if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .setIndex( o1 ) ))
return -1;
offset = o1;
}
} else {
int ch = op.getData();
if (dx > 0) {
if (offset >= con.limit || ch != target .setIndex( offset ) )
return -1;
offset ++;
} else {
int o1 = offset-1;
if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) )
return -1;
offset = o1;
}
}
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 matchString(Context, Op, int, int, int)
|
|
Method name: int matchCharacterIterator(Context, Op, int, int, int)
|
Number of AST nodes: 19
|
|
Number of AST nodes: 19
|
|
1 | if (isSet(opts, IGNORE_CASE)) {↵ | | 1 | if (isSet(opts, IGNORE_CASE)) {↵
|
2 | int ch = op.getData();↵ | | 2 | int ch = op.getData();↵
|
3 | if (dx > 0) {↵ | | 3 | if (dx > 0) {↵
|
4 | if (offset >= con.limit || !matchIgnoreCase(ch, target .charAt( offset ) ))↵ | | 4 | if (offset >= con.limit || !matchIgnoreCase(ch, target .setIndex( offset ) ))↵
|
5 | return -1;↵ | | 5 | return -1;↵
|
6 | offset ++;↵ | | 6 | offset ++;↵
|
7 | } else {↵ | | 7 | } else {↵
|
8 | int o1 = offset-1;↵ | | 8 | int o1 = offset-1;↵
|
9 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .charAt( o1 ) ))↵ | | 9 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .setIndex( o1 ) ))↵
|
10 | return -1;↵ | | 10 | return -1;↵
|
11 | offset = o1;↵ | | 11 | offset = o1;↵
|
12 | }↵ | | 12 | }↵
|
13 | } else {↵ | | 13 | } else {↵
|
14 | int ch = op.getData();↵ | | 14 | int ch = op.getData();↵
|
15 | if (dx > 0) {↵ | | 15 | if (dx > 0) {↵
|
16 | if (offset >= con.limit || ch != target .charAt( offset ) )↵ | | 16 | if (offset >= con.limit || ch != target .setIndex( offset ) )↵
|
17 | return -1;↵ | | 17 | return -1;↵
|
18 | offset ++;↵ | | 18 | offset ++;↵
|
19 | } else {↵ | | 19 | } else {↵
|
20 | int o1 = offset-1;↵ | | 20 | int o1 = offset-1;↵
|
21 | if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) )↵ | | 21 | if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) )↵
|
22 | return -1;↵ | | 22 | return -1;↵
|
23 | offset = o1;↵ | | 23 | offset = o1;↵
|
24 | }↵ | | 24 | }↵
|
25 | } | | 25 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 2 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 3.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 69 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 9 |
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) | 51.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
10 | int ch = op.getData(); | | 19 | int ch = op.getData(); |
11 | if (dx > 0) | | 20 | if (dx > 0) |
12 | if (offset >= con.limit || !matchIgnoreCase(ch, target.charAt(offset))) | | 21 | if (offset >= con.limit || ch != target.setIndex(offset)) |
13 | | | 22 | |
14 | | | 23 | |
| | | | |
15 | | | 24 | |
16 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.charAt(o1))) | | 25 | if (o1 >= con.limit || o1 < 0 || ch != target.setIndex(o1)) |
17 | | | 26 | |
18 | | | 27 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression !matchIgnoreCase(ch,target.charAt(offset)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression ch != target.setIndex(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression !matchIgnoreCase(ch,target.charAt(o1)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression ch != target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 9 |
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) | 54.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
19 | int ch = op.getData(); | | 10 | int ch = op.getData(); |
20 | if (dx > 0) | | 11 | if (dx > 0) |
21 | if (offset >= con.limit || ch != target.charAt(offset)) | | 12 | if (offset >= con.limit || !matchIgnoreCase(ch, target.setIndex(offset))) |
22 | | | 13 | |
23 | | | 14 | |
| | | | |
24 | | | 15 | |
25 | if (o1 >= con.limit || o1 < 0 || ch != target.charAt(o1)) | | 16 | if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.setIndex(o1))) |
26 | | | 17 | |
27 | | | 18 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression ch != target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression !matchIgnoreCase(ch,target.setIndex(offset)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression ch != target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression !matchIgnoreCase(ch,target.setIndex(o1)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |