if (dx > 0) { if (offset >= con.limit || ch != target .charAt( offset ) ) return -1; offset ++; } else { int o1 = offset-1; if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) ) return -1; offset = o1; }
if (dx > 0) { if (offset >= con.limit || ch != target .setIndex( offset ) ) return -1; offset ++; } else { int o1 = offset-1; if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) ) return -1; offset = o1; }
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: 8 Number of AST nodes: 8
1
if (dx > 0) {
1
if (dx > 0) {
2
                          if (offset >= con.limit || ch !=  target .charAt(  offset ) )
2
                          if (offset >= con.limit || ch !=  target .setIndex(  offset ) )
3
                              return -1;
3
                              return -1;
4
                          offset ++;
4
                          offset ++;
5
                      } else {
5
                      } else {
6
                          int o1 = offset-1;
6
                          int o1 = offset-1;
7
                          if (o1 >= con.limit || o1 < 0 || ch !=  target .charAt(  o1 ) )
7
                          if (o1 >= con.limit || o1 < 0 || ch !=  target .setIndex(  o1 ) )
8
                              return -1;
8
                              return -1;
9
                          offset = o1;
9
                          offset = o1;
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)1.7
Clones locationClones are declared in the same class
Number of node comparisons34
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)47.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    20
    if (dx > 0)
    20
    if (dx > 0)
    21
    if (offset >= con.limit || ch != target.charAt(offset))
    21
    if (offset >= con.limit || ch != target.charAt(offset))
    21
    if (offset >= con.limit || ch != target.setIndex(offset))
    Differences
    Expression1Expression2Difference
    charAtsetIndexMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression target.charAt(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
    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
    21
    if (offset >= con.limit || ch != target.setIndex(offset))
    22
    return -1;
    22
    return -1;
    23
    offset++;
    23
    offset++;
    else
    else
    24
    int o1 = offset - 1;
    24
    int o1 = offset - 1;
    25
    if (o1 >= con.limit || o1 < 0 || ch != target.charAt(o1))
    25
    if (o1 >= con.limit || o1 < 0 || ch != target.charAt(o1))
    25
    if (o1 >= con.limit || o1 < 0 || ch != target.setIndex(o1))
    Differences
    Expression1Expression2Difference
    charAtsetIndexMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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
    25
    if (o1 >= con.limit || o1 < 0 || ch != target.setIndex(o1))
    26
    return -1;
    26
    return -1;
    27
    offset = o1;
    27
    offset = o1;
    Precondition Violations (6)
    Row Violation
    1Expression target.charAt(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
    3Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    4Expression target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression target.setIndex(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target