if (offset < 0) return false; if (limit-offset < partlen) return false; int i = offset2; while (partlen-- > 0) { char ch1 = target [ offset++ ] ; char ch2 = target [ i++ ] ; if (ch1 == ch2) continue; char uch1 = Character.toUpperCase(ch1); char uch2 = Character.toUpperCase(ch2); if (uch1 == uch2) continue; if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) return false; } return true;
if (offset < 0) return false; if (limit-offset < partlen) return false; int i = 0; while (partlen-- > 0) { char ch1 = target .setIndex( offset++ ) ; char ch2 = part.charAt(i++); if (ch1 == ch2) continue; char uch1 = Character.toUpperCase(ch1); char uch2 = Character.toUpperCase(ch2); if (uch1 == uch2) continue; if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2)) return false; } return true;
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: boolean regionMatchesIgnoreCase(char[], int, int, int, int) Method name: boolean regionMatchesIgnoreCase(CharacterIterator, int, int, String, int)
Number of AST nodes: 17 Number of AST nodes: 17
1
if (offset < 0)  return false;
1
if (offset < 0)  return false;
2
          if (limit-offset < partlen)
2
          if (limit-offset < partlen)
3
              return false;
3
              return false;
4
          int i = offset2;
4
          int i = 0;
5
          while (partlen-- > 0) {
5
          while (partlen-- > 0) {
6
              char ch1 =  target [  offset++ ] ;
6
              char ch1 =  target .setIndex(  offset++ ) ;
7
              char ch2 =  target [  i++ ] ;
7
              char ch2 = part.charAt(i++);
8
              if (ch1 == ch2)
8
              if (ch1 == ch2)
9
                  continue;
9
                  continue;
10
              char uch1 = Character.toUpperCase(ch1);
10
              char uch1 = Character.toUpperCase(ch1);
11
              char uch2 = Character.toUpperCase(ch2);
11
              char uch2 = Character.toUpperCase(ch2);
12
              if (uch1 == uch2)
12
              if (uch1 == uch2)
13
                  continue;
13
                  continue;
14
              if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
14
              if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
15
                  return false;
15
                  return false;
16
          }
16
          }
17
          return true;
17
          return true;
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)0.9
Clones locationClones are declared in the same class
Number of node comparisons69
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (offset < 0)
    1
    if (offset < 0)
    2
    return false;
    2
    return false;
    3
    if (limit - offset < partlen)
    3
    if (limit - offset < partlen)
    4
    return false;
    4
    return false;
    5
    int i = offset2;
    5
    int i = offset2;
    5
    int i = 0;
    Differences
    Expression1Expression2Difference
    offset20TYPE_COMPATIBLE_REPLACEMENT
    5
    int i = 0;
    6
    while (partlen-- > 0)
    6
    while (partlen-- > 0)
    7
    char ch1 = target[offset++];
    7
    char ch1 = target[offset++];
    7
    char ch1 = target.setIndex(offset++);
    Differences
    Expression1Expression2Difference
    target[offset++]target.setIndex(offset++)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[offset++] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.setIndex(offset++) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    char ch1 = target.setIndex(offset++);
    8
    char ch2 = target[i++];
    8
    char ch2 = target[i++];
    8
    char ch2 = part.charAt(i++);
    Differences
    Expression1Expression2Difference
    target[i++]part.charAt(i++)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[i++] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression part.charAt(i++) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    char ch2 = part.charAt(i++);
    9
    if (ch1 == ch2)
    9
    if (ch1 == ch2)
    10
    continue;
    10
    continue;
    11
    char uch1 = Character.toUpperCase(ch1);
    11
    char uch1 = Character.toUpperCase(ch1);
    12
    char uch2 = Character.toUpperCase(ch2);
    12
    char uch2 = Character.toUpperCase(ch2);
    13
    if (uch1 == uch2)
    13
    if (uch1 == uch2)
    14
    continue;
    14
    continue;
    15
    if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
    15
    if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
    16
    return false;
    16
    return false;
    17
    return true;
    17
    return true;
    Precondition Violations (4)
    Row Violation
    1Expression target[offset++] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression target.setIndex(offset++) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression target[i++] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression part.charAt(i++) cannot be parameterized, because it has dependencies to/from statements that will be extracted