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: boolean matches(String, int, int, Match)
|
Method name: boolean matches(CharacterIterator, Match)
|
|||
Number of AST nodes: 41 | Number of AST nodes: 41 | |||
1 | if (this.operations != null↵ | 1 | if (this.operations != null↵ | |
2 | && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {↵ | 2 | && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {↵ | |
3 | if (isSet(this.options, SINGLE_LINE)) {↵ | 3 | if (isSet(this.options, SINGLE_LINE)) {↵ | |
4 | matchStart = con.start;↵ | 4 | matchStart = con.start;↵ | |
5 | matchEnd = this. matchString (con, this.operations, con.start, 1, this.options);↵ | 5 | matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options);↵ | |
6 | } else {↵ | 6 | } else {↵ | |
7 | boolean previousIsEOL = true;↵ | 7 | boolean previousIsEOL = true;↵ | |
8 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | 8 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | |
9 | int ch = target .charAt( matchStart ) ;↵ | 9 | int ch = target .setIndex( matchStart ) ;↵ | |
10 | if (isEOLChar(ch)) {↵ | 10 | if (isEOLChar(ch)) {↵ | |
11 | previousIsEOL = true;↵ | 11 | previousIsEOL = true;↵ | |
12 | } else {↵ | 12 | } else {↵ | |
13 | if (previousIsEOL) {↵ | 13 | if (previousIsEOL) {↵ | |
14 | if (0 <= (matchEnd = this. matchString (con, this.operations,↵ | 14 | if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,↵ | |
15 | matchStart, 1, this.options)))↵ | 15 | matchStart, 1, this.options)))↵ | |
16 | break;↵ | 16 | break;↵ | |
17 | }↵ | 17 | }↵ | |
18 | previousIsEOL = false;↵ | 18 | previousIsEOL = false;↵ | |
19 | }↵ | 19 | }↵ | |
20 | }↵ | 20 | }↵ | |
21 | }↵ | 21 | }↵ | |
22 | }↵ | 22 | }↵ | |
23 | /*↵ | 23 | /*↵ | |
24 | * Optimization against the first character.↵ | 24 | * Optimization against the first character.↵ | |
25 | */↵ | 25 | */↵ | |
26 | else if (this.firstChar != null) {↵ | 26 | else if (this.firstChar != null) {↵ | |
27 | //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);↵ | 27 | //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);↵ | |
28 | RangeToken range = this.firstChar;↵ | 28 | RangeToken range = this.firstChar;↵ | |
29 | if (RegularExpression.isSet(this.options, IGNORE_CASE)) {↵ | 29 | if (RegularExpression.isSet(this.options, IGNORE_CASE)) {↵ | |
30 | range = this.firstChar.getCaseInsensitiveToken();↵ | 30 | range = this.firstChar.getCaseInsensitiveToken();↵ | |
31 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | 31 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | |
32 | int ch = target .charAt( matchStart ) ;↵ | 32 | int ch = target .setIndex( matchStart ) ;↵ | |
33 | if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) {↵ | 33 | if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) {↵ | |
34 | ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) );↵ | 34 | ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) );↵ | |
35 | if (!range.match(ch)) continue;↵ | 35 | if (!range.match(ch)) continue;↵ | |
36 | } else {↵ | 36 | } else {↵ | |
37 | if (!range.match(ch)) {↵ | 37 | if (!range.match(ch)) {↵ | |
38 | char ch1 = Character.toUpperCase((char)ch);↵ | 38 | char ch1 = Character.toUpperCase((char)ch);↵ | |
39 | if (!range.match(ch1))↵ | 39 | if (!range.match(ch1))↵ | |
40 | if (!range.match(Character.toLowerCase(ch1)))↵ | 40 | if (!range.match(Character.toLowerCase(ch1)))↵ | |
41 | continue;↵ | 41 | continue;↵ | |
42 | }↵ | 42 | }↵ | |
43 | }↵ | 43 | }↵ | |
44 | if (0 <= (matchEnd = this. matchString (con, this.operations,↵ | 44 | if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,↵ | |
45 | matchStart, 1, this.options)))↵ | 45 | matchStart, 1, this.options)))↵ | |
46 | break;↵ | 46 | break;↵ | |
47 | }↵ | 47 | }↵ | |
48 | } else {↵ | 48 | } else {↵ | |
49 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | 49 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | |
50 | int ch = target .charAt( matchStart ) ;↵ | 50 | int ch = target .setIndex( matchStart ) ;↵ | |
51 | if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)↵ | 51 | if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)↵ | |
52 | ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) );↵ | 52 | ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) );↵ | |
53 | if (!range.match(ch)) continue;↵ | 53 | if (!range.match(ch)) continue;↵ | |
54 | if (0 <= (matchEnd = this. matchString (con, this.operations,↵ | 54 | if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,↵ | |
55 | matchStart, 1, this.options)))↵ | 55 | matchStart, 1, this.options)))↵ | |
56 | break;↵ | 56 | break;↵ | |
57 | }↵ | 57 | }↵ | |
58 | }↵ | 58 | }↵ | |
59 | }↵ | 59 | }↵ | |
60 | /*↵ | 60 | /*↵ | |
61 | * Straightforward matching.↵ | 61 | * Straightforward matching.↵ | |
62 | */↵ | 62 | */↵ | |
63 | else {↵ | 63 | else {↵ | |
64 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | 64 | for (matchStart = con.start; matchStart <= limit; matchStart ++) {↵ | |
65 | if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options)))↵ | 65 | if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options)))↵ | |
66 | break;↵ | 66 | break;↵ | |
67 | }↵ | 67 | }↵ | |
68 | } | 68 |
| |
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) | 8.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 170 |
Number of mapped statements | 41 |
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) | 18.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
49 | if (this.operations != null && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) | 46 | if (this.operations != null && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) | |||||||||||||||||
50 | if (isSet(this.options, SINGLE_LINE)) | 47 | if (isSet(this.options, SINGLE_LINE)) | |||||||||||||||||
51 | matchStart = con.start; | 48 | matchStart = con.start; | |||||||||||||||||
52 | matchEnd = this.matchString(con, this.operations, con.start, 1, this.options); |
| 49 | matchEnd = this.matchCharacterIterator(con, this.operations, con.start, 1, this.options); | ||||||||||||||||
else | else | |||||||||||||||||||
53 | boolean previousIsEOL = true; | 50 | boolean previousIsEOL = true; | |||||||||||||||||
54 | for (matchStart = con.start; matchStart <= limit; matchStart++) | 51 | for (matchStart = con.start; matchStart <= limit; matchStart++) | |||||||||||||||||
55 | int ch = target.charAt(matchStart); |
| 52 | int ch = target.setIndex(matchStart); | ||||||||||||||||
56 | if (isEOLChar(ch)) | 53 | if (isEOLChar(ch)) | |||||||||||||||||
57 | previousIsEOL = true; | 54 | previousIsEOL = true; | |||||||||||||||||
else | else | |||||||||||||||||||
58 | if (previousIsEOL) | 55 | if (previousIsEOL) | |||||||||||||||||
59 | if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options))) |
| 56 | if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options))) | ||||||||||||||||
60 | break; | 57 | break; | |||||||||||||||||
61 | previousIsEOL = false; | 58 | previousIsEOL = false; | |||||||||||||||||
62 | else if (this.firstChar != null) | 59 | else if (this.firstChar != null) | |||||||||||||||||
63 | RangeToken range = this.firstChar; | 60 | RangeToken range = this.firstChar; | |||||||||||||||||
64 | if (RegularExpression.isSet(this.options, IGNORE_CASE)) | 61 | if (RegularExpression.isSet(this.options, IGNORE_CASE)) | |||||||||||||||||
65 | range = this.firstChar.getCaseInsensitiveToken(); | 62 | range = this.firstChar.getCaseInsensitiveToken(); | |||||||||||||||||
66 | for (matchStart = con.start; matchStart <= limit; matchStart++) | 63 | for (matchStart = con.start; matchStart <= limit; matchStart++) | |||||||||||||||||
67 | int ch = target.charAt(matchStart); |
| 64 | int ch = target.setIndex(matchStart); | ||||||||||||||||
68 | if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) | 65 | if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) | |||||||||||||||||
69 | ch = REUtil.composeFromSurrogates(ch, target.charAt(matchStart + 1)); |
| 66 | ch = REUtil.composeFromSurrogates(ch, target.setIndex(matchStart + 1)); | ||||||||||||||||
70 | if (!range.match(ch)) | 67 | if (!range.match(ch)) | |||||||||||||||||
71 | continue; | 68 | continue; | |||||||||||||||||
else | else | |||||||||||||||||||
72 | if (!range.match(ch)) | 69 | if (!range.match(ch)) | |||||||||||||||||
73 | char ch1 = Character.toUpperCase((char)ch); | 70 | char ch1 = Character.toUpperCase((char)ch); | |||||||||||||||||
74 | if (!range.match(ch1)) | 71 | if (!range.match(ch1)) | |||||||||||||||||
75 | if (!range.match(Character.toLowerCase(ch1))) | 72 | if (!range.match(Character.toLowerCase(ch1))) | |||||||||||||||||
76 | continue; | 73 | continue; | |||||||||||||||||
77 | if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options))) |
| 74 | if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options))) | ||||||||||||||||
78 | break; | 75 | break; | |||||||||||||||||
else | else | |||||||||||||||||||
79 | for (matchStart = con.start; matchStart <= limit; matchStart++) | 76 | for (matchStart = con.start; matchStart <= limit; matchStart++) | |||||||||||||||||
80 | int ch = target.charAt(matchStart); |
| 77 | int ch = target.setIndex(matchStart); | ||||||||||||||||
81 | if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) | 78 | if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) | |||||||||||||||||
82 | ch = REUtil.composeFromSurrogates(ch, target.charAt(matchStart + 1)); |
| 79 | ch = REUtil.composeFromSurrogates(ch, target.setIndex(matchStart + 1)); | ||||||||||||||||
83 | if (!range.match(ch)) | 80 | if (!range.match(ch)) | |||||||||||||||||
84 | continue; | 81 | continue; | |||||||||||||||||
85 | if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options))) |
| 82 | if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options))) | ||||||||||||||||
86 | break; | 83 | break; | |||||||||||||||||
else | else | |||||||||||||||||||
87 | for (matchStart = con.start; matchStart <= limit; matchStart++) | 84 | for (matchStart = con.start; matchStart <= limit; matchStart++) | |||||||||||||||||
88 | if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options))) |
| 85 | if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options))) | ||||||||||||||||
89 | break; | 86 | break; |
Row | Violation |
---|---|
1 | Expression this.matchString(con,this.operations,con.start,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression this.matchCharacterIterator(con,this.operations,con.start,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression target.charAt(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression target.setIndex(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
6 | Expression this.matchString(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression target.charAt(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression target.setIndex(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
11 | Expression target.charAt(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression target.setIndex(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
14 | Expression this.matchString(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
16 | Expression target.charAt(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression target.setIndex(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
19 | Expression target.charAt(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression target.setIndex(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target |
22 | Expression this.matchString(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression this.matchString(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
25 | Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
26 | Clone fragment #1 returns variables matchEnd, matchStart , while Clone fragment #2 returns variables matchEnd, matchStart |