if (!isSet(opts, IGNORE_CASE)) { if (dx > 0) { if (!regionMatches(target, offset, con.limit, literal, literallen)) return -1; offset += literallen; } else { if (!regionMatches(target, offset-literallen, con.limit, literal, literallen)) return -1; offset -= literallen; } } else { if (dx > 0) { if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) return -1; offset += literallen; } else { if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, literal, literallen)) return -1; offset -= literallen; } }
if (!isSet(opts, IGNORE_CASE)) { if (dx > 0) { if (!regionMatches(target, offset, con.limit, o2, literallen)) return -1; offset += literallen; } else { if (!regionMatches(target, offset-literallen, con.limit, o2, literallen)) return -1; offset -= literallen; } } else { if (dx > 0) { if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) return -1; offset += literallen; } else { if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit, o2, literallen)) return -1; offset -= literallen; } }
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: 15 Number of AST nodes: 15
1
if (!isSet(opts, IGNORE_CASE)) {
1
if (!isSet(opts, IGNORE_CASE)) {
2
                          if (dx > 0) {
2
                          if (dx > 0) {
3
                              if (!regionMatches(target, offset, con.limit, literal, literallen))
3
                              if (!regionMatches(target, offset, con.limit, o2, literallen))
4
                                  return -1;
4
                                  return -1;
5
                              offset += literallen;
5
                              offset += literallen;
6
                          } else {
6
                          } else {
7
                              if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))
7
                              if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))
8
                                  return -1;
8
                                  return -1;
9
                              offset -= literallen;
9
                              offset -= literallen;
10
                          }
10
                          }
11
                      } else {
11
                      } else {
12
                          if (dx > 0) {
12
                          if (dx > 0) {
13
                              if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
13
                              if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
14
                                  return -1;
14
                                  return -1;
15
                              offset += literallen;
15
                              offset += literallen;
16
                          } else {
16
                          } else {
17
                              if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
17
                              if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
18
                                                           literal, literallen))
18
                                                           o2, literallen))
19
                                  return -1;
19
                                  return -1;
20
                              offset -= literallen;
20
                              offset -= literallen;
21
                          }
21
                          }
22
                      }
22
                      }
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)2.3
Clones locationClones are declared in the same class
Number of node comparisons48
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)25.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                      
    170
    if (!isSet(opts, IGNORE_CASE))
                                  
    171
    if (dx > 0)
                                                    
    174
    offset += literallen;
    Preondition Violations
    Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    174
    offset += literallen;
            
    else
                                                    
    177
    offset -= literallen;
    Preondition Violations
    Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    177
    offset -= literallen;
                                  
    178
    if (dx > 0)
                                                    
    181
    offset += literallen;
    Preondition Violations
    Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    181
    offset += literallen;
            
    else
                                                    
    184
    offset -= literallen;
    Preondition Violations
    Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    184
    offset -= literallen;
    190
    if (!isSet(opts, IGNORE_CASE))
                                                                      
    191
    if (dx > 0)
                                  
    194
    offset += literallen;
    194
    offset += literallen;
    Preondition Violations
    Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    else
            
    197
    offset -= literallen;
    197
    offset -= literallen;
    Preondition Violations
    Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    198
    if (dx > 0)
                                  
    201
    offset += literallen;
    201
    offset += literallen;
    Preondition Violations
    Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    else
            
    204
    offset -= literallen;
    204
    offset -= literallen;
    Preondition Violations
    Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    192
    if (!regionMatches(target, offset, con.limit, literal, literallen))
    192
    if (!regionMatches(target, offset, con.limit, literal, literallen))
    175
    if (!regionMatches(target, offset - literallen, con.limit, o2, literallen))
    Differences
    Expression1Expression2Difference
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    • Make classes java.lang.String and java.text.CharacterIterator extend a common superclass
    175
    if (!regionMatches(target, offset - literallen, con.limit, o2, literallen))
    193
    return -1;
    176
    return -1;
    195
    if (!regionMatches(target, offset - literallen, con.limit, literal, literallen))
    195
    if (!regionMatches(target, offset - literallen, con.limit, literal, literallen))
    172
    if (!regionMatches(target, offset, con.limit, o2, literallen))
    Differences
    Expression1Expression2Difference
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    • Make classes java.lang.String and java.text.CharacterIterator extend a common superclass
    172
    if (!regionMatches(target, offset, con.limit, o2, literallen))
    196
    return -1;
    173
    return -1;
    199
    if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
    199
    if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
    182
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen))
    Differences
    Expression1Expression2Difference
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    • Make classes java.lang.String and java.text.CharacterIterator extend a common superclass
    182
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen))
    200
    return -1;
    183
    return -1;
    202
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen))
    202
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen))
    179
    if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
    Differences
    Expression1Expression2Difference
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    • Make classes java.lang.String and java.text.CharacterIterator extend a common superclass
    179
    if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
    203
    return -1;
    180
    return -1;
    Precondition Violations (12)
    Row Violation
    1Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement offset-=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    10Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    11Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    12Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target