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; }
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; }
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: 7 Number of AST nodes: 7
1
if (dx > 0) {
1
if (dx > 0) {
2
                              if (!regionMatches(target, offset, con.limit, literal, literallen))
2
                              if (!regionMatches(target, offset, con.limit, o2, literallen))
3
                                  return -1;
3
                                  return -1;
4
                              offset += literallen;
4
                              offset += literallen;
5
                          } else {
5
                          } else {
6
                              if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))
6
                              if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))
7
                                  return -1;
7
                                  return -1;
8
                              offset -= literallen;
8
                              offset -= literallen;
9
                          }
9
                          }
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.7
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)10.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    191
    if (dx > 0)
    191
    if (dx > 0)
    171
    if (dx > 0)
    Differences
    Expression1Expression2Difference
    dx > 0dx > 0IF_ELSE_SYMMETRICAL_MATCH
    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;
    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;
    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
    else
    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;
                                                    
    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;
    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
                                                    
    Precondition Violations (6)
    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
    2Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    3Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    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