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 (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; }
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 matchCharacterIterator(Context, Op, int, int, int) Method name: int matchString(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 (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
2
                              if (!regionMatches(target, offset, con.limit, literal, literallen))
3
                                  return -1;
3
                                  return -1;
4
                              offset += literallen;
4
                              offset += literallen;
5
                          } else {
5
                          } else {
6
                              if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
6
                              if (!regionMatches(target, offset-literallen, con.limit,
7
                                                           literal, literallen))
7
 literal, literallen))
8
                                  return -1;
8
                                  return -1;
9
                              offset -= literallen;
9
                              offset -= literallen;
10
                          }
10
                          }
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.6
Clones locationClones are declared in the same class
Number of node comparisons17
  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)8.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    198
    if (dx > 0)
    198
    if (dx > 0)
    191
    if (dx > 0)
    Differences
    Expression1Expression2Difference
    dx > 0dx > 0IF_ELSE_SYMMETRICAL_MATCH
    191
    if (dx > 0)
                                                    
    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
    194
    offset += literallen;
    199
    if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
    199
    if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
    195
    if (!regionMatches(target, offset - literallen, con.limit, literal, literallen))
    Differences
    Expression1Expression2Difference
    regionMatchesIgnoreCaseregionMatchesMETHOD_INVOCATION_NAME_MISMATCH
    java.text.CharacterIteratorjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression regionMatchesIgnoreCase(target,offset,con.limit,literal,literallen) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method regionMatchesIgnoreCase
    Type java.text.CharacterIterator of variable target does not match with type java.lang.String of variable target
    • Make classes java.text.CharacterIterator and java.lang.String extend a common superclass
    195
    if (!regionMatches(target, offset - literallen, con.limit, literal, literallen))
    200
    return -1;
    196
    return -1;
    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
    else
    202
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen))
    202
    if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen))
    192
    if (!regionMatches(target, offset, con.limit, literal, literallen))
    Differences
    Expression1Expression2Difference
    regionMatchesIgnoreCaseregionMatchesMETHOD_INVOCATION_NAME_MISMATCH
    java.text.CharacterIteratorjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression regionMatchesIgnoreCase(target,offset - literallen,con.limit,literal,literallen) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method regionMatchesIgnoreCase
    Type java.text.CharacterIterator of variable target does not match with type java.lang.String of variable target
    • Make classes java.text.CharacterIterator and java.lang.String extend a common superclass
    192
    if (!regionMatches(target, offset, con.limit, literal, literallen))
    203
    return -1;
    193
    return -1;
                                                    
    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
    197
    offset -= literallen;
    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
                                                    
    Precondition Violations (8)
    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
    2Expression regionMatchesIgnoreCase(target,offset,con.limit,literal,literallen) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.text.CharacterIterator of variable target does not match with type java.lang.String of variable target
    4Unmatched statement offset+=literallen; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression regionMatchesIgnoreCase(target,offset - literallen,con.limit,literal,literallen) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.text.CharacterIterator of variable target does not match with type java.lang.String of variable target
    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