switch (op.getData()) { case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start || offset > con.start && isEOLChar( target .charAt( offset-1 ) ))) return -1; } else { if (offset != con.start) return -1; } break; case '@': // Internal use only. // The @ always matches line beginnings. if (!(offset == con.start || offset > con.start && isEOLChar( target .charAt( offset-1 ) ))) return -1; break; case '$': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.limit || offset < con.limit && isEOLChar( target .charAt( offset ) ))) return -1; } else { if (!(offset == con.limit || offset+1 == con.limit && isEOLChar( target .charAt( offset ) ) || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN && target .charAt( offset+1 ) == LINE_FEED)) return -1; } break; case 'A': if (offset != con.start) return -1; break; case 'Z': if (!(offset == con.limit || offset+1 == con.limit && isEOLChar( target .charAt( offset ) ) || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN && target .charAt( offset+1 ) == LINE_FEED)) return -1; break; case 'z': if (offset != con.limit) return -1; break; case 'b': if (con.length == 0) return -1; { int after = getWordType(target, con.start, con.limit, offset, opts); if (after == WT_IGNORE) return -1; int before = getPreviousWordType(target, con.start, con.limit, offset, opts); if (after == before) return -1; } break; case 'B': if (con.length == 0) go = true; else { int after = getWordType(target, con.start, con.limit, offset, opts); go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts); } if (!go) return -1; break; case '<': if (con.length == 0 || offset == con.limit) return -1; if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) return -1; break; case '>': if (con.length == 0 || offset == con.start) return -1; if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) return -1; break; }
switch (op.getData()) { case '^': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.start || offset > con.start && isEOLChar( target .setIndex( offset-1 ) ))) return -1; } else { if (offset != con.start) return -1; } break; case '@': // Internal use only. // The @ always matches line beginnings. if (!(offset == con.start || offset > con.start && isEOLChar( target .setIndex( offset-1 ) ))) return -1; break; case '$': if (isSet(opts, MULTIPLE_LINES)) { if (!(offset == con.limit || offset < con.limit && isEOLChar( target .setIndex( offset ) ))) return -1; } else { if (!(offset == con.limit || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) ) || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN && target .setIndex( offset+1 ) == LINE_FEED)) return -1; } break; case 'A': if (offset != con.start) return -1; break; case 'Z': if (!(offset == con.limit || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) ) || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN && target .setIndex( offset+1 ) == LINE_FEED)) return -1; break; case 'z': if (offset != con.limit) return -1; break; case 'b': if (con.length == 0) return -1; { int after = getWordType(target, con.start, con.limit, offset, opts); if (after == WT_IGNORE) return -1; int before = getPreviousWordType(target, con.start, con.limit, offset, opts); if (after == before) return -1; } break; case 'B': if (con.length == 0) go = true; else { int after = getWordType(target, con.start, con.limit, offset, opts); go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts); } if (!go) return -1; break; case '<': if (con.length == 0 || offset == con.limit) return -1; if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) return -1; break; case '>': if (con.length == 0 || offset == con.start) return -1; if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) return -1; 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: int matchString(Context, Op, int, int, int) Method name: int matchCharacterIterator(Context, Op, int, int, int)
Number of AST nodes: 61 Number of AST nodes: 61
1
switch (op.getData()) {
1
switch (op.getData()) {
2
                  case '^':
2
                  case '^':
3
                      if (isSet(opts, MULTIPLE_LINES)) {
3
                      if (isSet(opts, MULTIPLE_LINES)) {
4
                          if (!(offset == con.start
4
                          if (!(offset == con.start
5
                                || offset > con.start && isEOLChar( target .charAt(  offset-1 ) )))
5
                                || offset > con.start && isEOLChar( target .setIndex(  offset-1 ) )))
6
                              return -1;
6
                              return -1;
7
                      } else {
7
                      } else {
8
                          if (offset != con.start)
8
                          if (offset != con.start)
9
                              return -1;
9
                              return -1;
10
                      }
10
                      }
11
                      break;
11
                      break;
12
                  case '@':                         // Internal use only.
12
                  case '@':                         // Internal use only.
13
                      // The @ always matches line beginnings.
13
                      // The @ always matches line beginnings.
14
                      if (!(offset == con.start
14
                      if (!(offset == con.start
15
                            || offset > con.start && isEOLChar( target .charAt(  offset-1 ) )))
15
                            || offset > con.start && isEOLChar( target .setIndex(  offset-1 ) )))
16
                          return -1;
16
                          return -1;
17
                      break;
17
                      break;
18
                  case '$':
18
                  case '$':
19
                      if (isSet(opts, MULTIPLE_LINES)) {
19
                      if (isSet(opts, MULTIPLE_LINES)) {
20
                          if (!(offset == con.limit
20
                          if (!(offset == con.limit
21
                                || offset < con.limit && isEOLChar( target .charAt(  offset ) )))
21
                                || offset < con.limit && isEOLChar( target .setIndex(  offset ) )))
22
                              return -1;
22
                              return -1;
23
                      } else {
23
                      } else {
24
                          if (!(offset == con.limit
24
                          if (!(offset == con.limit
25
                                || offset+1 == con.limit && isEOLChar( target .charAt(  offset ) )
25
                                || offset+1 == con.limit && isEOLChar( target .setIndex(  offset ) )
26
                                || offset+2 == con.limit &&  target .charAt(  offset )  == CARRIAGE_RETURN
26
                                || offset+2 == con.limit &&  target .setIndex(  offset )  == CARRIAGE_RETURN
27
                                &&  target .charAt(  offset+1 )  == LINE_FEED))
27
                                &&  target .setIndex(  offset+1 )  == LINE_FEED))
28
                              return -1;
28
                              return -1;
29
                      }
29
                      }
30
                      break;
30
                      break;
31
                  case 'A':
31
                  case 'A':
32
                      if (offset != con.start)  return -1;
32
                      if (offset != con.start)  return -1;
33
                      break;
33
                      break;
34
                  case 'Z':
34
                  case 'Z':
35
                      if (!(offset == con.limit
35
                      if (!(offset == con.limit
36
                            || offset+1 == con.limit && isEOLChar( target .charAt(  offset ) )
36
                            || offset+1 == con.limit && isEOLChar( target .setIndex(  offset ) )
37
                            || offset+2 == con.limit &&  target .charAt(  offset )  == CARRIAGE_RETURN
37
                            || offset+2 == con.limit &&  target .setIndex(  offset )  == CARRIAGE_RETURN
38
                            &&  target .charAt(  offset+1 )  == LINE_FEED))
38
                            &&  target .setIndex(  offset+1 )  == LINE_FEED))
39
                          return -1;
39
                          return -1;
40
                      break;
40
                      break;
41
                  case 'z':
41
                  case 'z':
42
                      if (offset != con.limit)  return -1;
42
                      if (offset != con.limit)  return -1;
43
                      break;
43
                      break;
44
                  case 'b':
44
                  case 'b':
45
                      if (con.length == 0)  return -1;
45
                      if (con.length == 0)  return -1;
46
                      {
46
                      {
47
                          int after = getWordType(target, con.start, con.limit, offset, opts);
47
                          int after = getWordType(target, con.start, con.limit, offset, opts);
48
                          if (after == WT_IGNORE)  return -1;
48
                          if (after == WT_IGNORE)  return -1;
49
                          int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
49
                          int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
50
                          if (after == before)  return -1;
50
                          if (after == before)  return -1;
51
                      }
51
                      }
52
                      break;
52
                      break;
53
                  case 'B':
53
                  case 'B':
54
                      if (con.length == 0)
54
                      if (con.length == 0)
55
                          go = true;
55
                          go = true;
56
                      else {
56
                      else {
57
                          int after = getWordType(target, con.start, con.limit, offset, opts);
57
                          int after = getWordType(target, con.start, con.limit, offset, opts);
58
                          go = after == WT_IGNORE
58
                          go = after == WT_IGNORE
59
                               || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
59
                               || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
60
                      }
60
                      }
61
                      if (!go)  return -1;
61
                      if (!go)  return -1;
62
                      break;
62
                      break;
63
                  case '<':
63
                  case '<':
64
                      if (con.length == 0 || offset == con.limit)  return -1;
64
                      if (con.length == 0 || offset == con.limit)  return -1;
65
                      if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER
65
                      if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER
66
                          || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)
66
                          || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)
67
                          return -1;
67
                          return -1;
68
                      break;
68
                      break;
69
                  case '>':
69
                  case '>':
70
                      if (con.length == 0 || offset == con.start)  return -1;
70
                      if (con.length == 0 || offset == con.start)  return -1;
71
                      if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER
71
                      if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER
72
                          || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)
72
                          || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)
73
                          return -1;
73
                          return -1;
74
                      break;
74
                      break;
75
                  }
75
                  }
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)31.9
Clones locationClones are declared in the same class
Number of node comparisons165