if (offset < 0) return false; if (limit-offset < partlen) return false; int i = 0; while (partlen-- > 0) { if ( target .setIndex( offset++ ) != part.charAt(i++)) return false; } return true;
if (offset < 0) return false; if (limit-offset < partlen) return false; int i = offset2; while (partlen-- > 0) { if ( target .setIndex( offset++ ) != target .setIndex( i++ ) ) 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 regionMatches(CharacterIterator, int, int, String, int) Method name: boolean regionMatches(CharacterIterator, int, int, int, int)
Number of AST nodes: 9 Number of AST nodes: 9
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 = 0;
4
          int i = offset2;
5
          while (partlen-- > 0) {
5
          while (partlen-- > 0) {
6
              if ( target .setIndex(  offset++ )  != part.charAt(i++))
6
              if ( target .setIndex(  offset++ )  !=  target .setIndex(  i++ ) )
7
                  return false;
7
                  return false;
8
          }
8
          }
9
          return true;
9
          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.4
Clones locationClones are declared in the same class
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 3
    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 = 0;
    5
    int i = 0;
    5
    int i = offset2;
    Differences
    Expression1Expression2Difference
    0offset2TYPE_COMPATIBLE_REPLACEMENT
    5
    int i = offset2;
                                                  
    6
    while (partlen-- > 0)
    Preondition Violations
    Unmatched statement while(partlen-- > 0) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    while (partlen-- > 0)
                                                                                                                    
    7
    if (target.setIndex(offset++) != target.setIndex(i++))
    Preondition Violations
    Unmatched statement if(target.setIndex(offset++) != target.setIndex(i++)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    if (target.setIndex(offset++) != target.setIndex(i++))
                                    
    8
    return false;
    Preondition Violations
    Unmatched return false;
    8
    return false;
    6
    while (partlen-- > 0)
    6
    while (partlen-- > 0)
    Preondition Violations
    Unmatched statement while(partlen-- > 0) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                  
    7
    if (target.setIndex(offset++) != part.charAt(i++))
    7
    if (target.setIndex(offset++) != part.charAt(i++))
    Preondition Violations
    Unmatched statement if(target.setIndex(offset++) != part.charAt(i++)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    8
    return false;
    8
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    9
    return true;
    9
    return true;
    Precondition Violations (7)
    Row Violation
    1Unmatched statement while(partlen-- > 0) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement if(target.setIndex(offset++) != target.setIndex(i++)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return false;
    4Unmatched statement while(partlen-- > 0) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement if(target.setIndex(offset++) != part.charAt(i++)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Not all possible execution flows end in a return statement