int ch = op.getData(); 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; }
int ch = op.getData(); if (dx > 0) { if (offset >= con.limit || !matchIgnoreCase(ch, target [ offset ] )) return -1; offset ++; } else { int o1 = offset-1; if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target [ 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 matchCharArray(Context, Op, int, int, int)
Number of AST nodes: 9 Number of AST nodes: 9
1
int ch = op.getData();
1
int ch = op.getData();
2
                      if (dx > 0) {
2
                      if (dx > 0) {
3
                          if (offset >= con.limit || ch !=  target .charAt(  offset ) )
3
                          if (offset >= con.limit || !matchIgnoreCase(ch,  target [  offset ] ))
4
                              return -1;
4
                              return -1;
5
                          offset ++;
5
                          offset ++;
6
                      } else {
6
                      } else {
7
                          int o1 = offset-1;
7
                          int o1 = offset-1;
8
                          if (o1 >= con.limit || o1 < 0 || ch !=  target .charAt(  o1 ) )
8
                          if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch,  target [  o1 ] ))
9
                              return -1;
9
                              return -1;
10
                          offset = o1;
10
                          offset = o1;
11
                      }
11
                      }
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.8
Clones locationClones are declared in the same class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)45.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    int ch = op.getData();
    10
    int ch = op.getData();
    20
    if (dx > 0)
    11
    if (dx > 0)
    21
    if (offset >= con.limit || ch != target.charAt(offset))
    21
    if (offset >= con.limit || ch != target.charAt(offset))
    12
    if (offset >= con.limit || !matchIgnoreCase(ch, target[offset]))
    Differences
    Expression1Expression2Difference
    ch != target.charAt(offset)!matchIgnoreCase(ch,target[offset])INFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression ch != target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !matchIgnoreCase(ch,target[offset]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (offset >= con.limit || !matchIgnoreCase(ch, target[offset]))
    22
    return -1;
    13
    return -1;
    23
    offset++;
    14
    offset++;
    else
    else
    24
    int o1 = offset - 1;
    15
    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))
    16
    if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target[o1]))
    Differences
    Expression1Expression2Difference
    ch != target.charAt(o1)!matchIgnoreCase(ch,target[o1])INFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression ch != target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !matchIgnoreCase(ch,target[o1]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target[o1]))
    26
    return -1;
    17
    return -1;
    27
    offset = o1;
    18
    offset = o1;
    Precondition Violations (4)
    Row Violation
    1Expression ch != target.charAt(offset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression !matchIgnoreCase(ch,target[offset]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ch != target.charAt(o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression !matchIgnoreCase(ch,target[o1]) cannot be parameterized, because it has dependencies to/from statements that will be extracted