if (this.operations != null && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { if (isSet(this.options, SINGLE_LINE)) { matchStart = con.start; matchEnd = this. matchString (con, this.operations, con.start, 1, this.options); } else { boolean previousIsEOL = true; for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .charAt( matchStart ) ; if (isEOLChar(ch)) { previousIsEOL = true; } else { if (previousIsEOL) { if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) break; } previousIsEOL = false; } } } } /* * Optimization against the first character. */ else if (this.firstChar != null) { //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar); RangeToken range = this.firstChar; if (RegularExpression.isSet(this.options, IGNORE_CASE)) { range = this.firstChar.getCaseInsensitiveToken(); for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .charAt( matchStart ) ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) { ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) ); if (!range.match(ch)) continue; } else { if (!range.match(ch)) { char ch1 = Character.toUpperCase((char)ch); if (!range.match(ch1)) if (!range.match(Character.toLowerCase(ch1))) continue; } } if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) break; } } else { for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .charAt( matchStart ) ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) ); if (!range.match(ch)) continue; if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) break; } } } /* * Straightforward matching. */ else { for (matchStart = con.start; matchStart <= limit; matchStart ++) { if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) break;
if (this.operations != null && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { if (isSet(this.options, SINGLE_LINE)) { matchStart = con.start; matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options); } else { boolean previousIsEOL = true; for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .setIndex( matchStart ) ; if (isEOLChar(ch)) { previousIsEOL = true; } else { if (previousIsEOL) { if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break; } previousIsEOL = false; } } } } /* * Optimization against the first character. */ else if (this.firstChar != null) { //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar); RangeToken range = this.firstChar; if (RegularExpression.isSet(this.options, IGNORE_CASE)) { range = this.firstChar.getCaseInsensitiveToken(); for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .setIndex( matchStart ) ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) { ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) ); if (!range.match(ch)) continue; } else { if (!range.match(ch)) { char ch1 = Character.toUpperCase((char)ch); if (!range.match(ch1)) if (!range.match(Character.toLowerCase(ch1))) continue; } } if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break; } } else { for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .setIndex( matchStart ) ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) ); if (!range.match(ch)) continue; if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break; } } } /* * Straightforward matching. */ else { for (matchStart = con.start; matchStart <= limit; matchStart ++) { if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break;
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
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
              
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0