int o1 = offset-1; if (o1 >= con.limit || o1 < 0) return -1; int ch = target [ o1 ] ; if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) ch = REUtil.composeFromSurrogates( target [ --o1 ] , ch); RangeToken tok = op.getToken(); if (isSet(opts, IGNORE_CASE)) { tok = tok.getCaseInsensitiveToken(); if (!tok.match(ch)) { if (ch >= 0x10000) return -1; char uch; if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) return -1; } } else { if (!tok.match(ch)) return -1; } offset = o1;
int o1 = offset-1; if (o1 >= con.limit || o1 < 0) return -1; int ch = target .charAt( o1 ) ; if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch); RangeToken tok = op.getToken(); if (isSet(opts, IGNORE_CASE)) { tok = tok.getCaseInsensitiveToken(); if (!tok.match(ch)) { if (ch >= 0x10000) return -1; char uch; if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch))) return -1; } } else { if (!tok.match(ch)) 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 matchCharArray(Context, Op, int, int, int) Method name: int matchString(Context, Op, int, int, int)
Number of AST nodes: 18 Number of AST nodes: 18
1
int o1 = offset-1;
1
int o1 = offset-1;
2
                      if (o1 >= con.limit || o1 < 0)
2
                      if (o1 >= con.limit || o1 < 0)
3
                          return -1;
3
                          return -1;
4
                      int ch =  target [  o1 ] ;
4
                      int ch =  target .charAt(  o1 ) ;
5
                      if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
5
                      if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
6
                          ch = REUtil.composeFromSurrogates( target [  --o1 ] , ch);
6
                          ch = REUtil.composeFromSurrogates( target .charAt(  --o1 ) , ch);
7
                      RangeToken tok = op.getToken();
7
                      RangeToken tok = op.getToken();
8
                      if (isSet(opts, IGNORE_CASE)) {
8
                      if (isSet(opts, IGNORE_CASE)) {
9
                          tok = tok.getCaseInsensitiveToken();
9
                          tok = tok.getCaseInsensitiveToken();
10
                          if (!tok.match(ch)) {
10
                          if (!tok.match(ch)) {
11
                              if (ch >= 0x10000)  return -1;
11
                              if (ch >= 0x10000)  return -1;
12
                              char uch;
12
                              char uch;
13
                              if (!tok.match(uch = Character.toUpperCase((char)ch))
13
                              if (!tok.match(uch = Character.toUpperCase((char)ch))
14
                                  && !tok.match(Character.toLowerCase(uch)))
14
                                  && !tok.match(Character.toLowerCase(uch)))
15
                                  return -1;
15
                                  return -1;
16
                          }
16
                          }
17
                      } else {
17
                      } else {
18
                          if (!tok.match(ch))  return -1;
18
                          if (!tok.match(ch))  return -1;
19
                      }
19
                      }
20
                      offset = o1;
20
                      offset = o1;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)3.0
Clones locationClones are declared in the same class
Number of node comparisons69
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)23.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    77
    int o1 = offset - 1;
    77
    int o1 = offset - 1;
    78
    if (o1 >= con.limit || o1 < 0)
    78
    if (o1 >= con.limit || o1 < 0)
    79
    return -1;
    79
    return -1;
    80
    int ch = target[o1];
    80
    int ch = target[o1];
    80
    int ch = target.charAt(o1);
    Differences
    Expression1Expression2Difference
    target[o1]target.charAt(o1)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[o1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    80
    int ch = target.charAt(o1);
    81
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    81
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    82
    ch = REUtil.composeFromSurrogates(target[--o1], ch);
    82
    ch = REUtil.composeFromSurrogates(target[--o1], ch);
    82
    ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
    Differences
    Expression1Expression2Difference
    target[--o1]target.charAt(--o1)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[--o1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    82
    ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
    83
    RangeToken tok = op.getToken();
    83
    RangeToken tok = op.getToken();
    84
    if (isSet(opts, IGNORE_CASE))
    84
    if (isSet(opts, IGNORE_CASE))
    85
    tok = tok.getCaseInsensitiveToken();
    85
    tok = tok.getCaseInsensitiveToken();
    86
    if (!tok.match(ch))
    86
    if (!tok.match(ch))
    87
    if (ch >= 0x10000)
    87
    if (ch >= 0x10000)
    88
    return -1;
    88
    return -1;
    89
    char uch;
    89
    char uch;
    90
    if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch)))
    90
    if (!tok.match(uch = Character.toUpperCase((char)ch)) && !tok.match(Character.toLowerCase(uch)))
    91
    return -1;
    91
    return -1;
    else
    else
    92
    if (!tok.match(ch))
    92
    if (!tok.match(ch))
    93
    return -1;
    93
    return -1;
    94
    offset = o1;
    94
    offset = o1;
    Precondition Violations (4)
    Row Violation
    1Expression target[o1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression target[--o1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted