int id = op.getData(); if (id >= 0) { int previousOffset = con.offsets[id]; if (previousOffset < 0 || previousOffset != offset) { con.offsets[id] = offset; } else { con.offsets[id] = -1; op = op.next; break; } } int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts); if (id >= 0) con.offsets[id] = -1; if (ret >= 0) return ret; op = op.next;
int id = op.getData(); if (id >= 0) { int previousOffset = con.offsets[id]; if (previousOffset < 0 || previousOffset != offset) { con.offsets[id] = offset; } else { con.offsets[id] = -1; op = op.next; break; } } int ret = this. matchString (con, op.getChild(), offset, dx, opts); if (id >= 0) con.offsets[id] = -1; if (ret >= 0) return ret; op = op.next;
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 matchCharArray(Context, Op, int, int, int) Method name: int matchString(Context, Op, int, int, int)
Number of AST nodes: 14 Number of AST nodes: 14
1
int id = op.getData();
1
int id = op.getData();
2
                      if (id >= 0) {
2
                      if (id >= 0) {
3
                          int previousOffset = con.offsets[id];
3
                          int previousOffset = con.offsets[id];
4
                          if (previousOffset < 0 || previousOffset != offset) {
4
                          if (previousOffset < 0 || previousOffset != offset) {
5
                              con.offsets[id] = offset;
5
                              con.offsets[id] = offset;
6
                          } else {
6
                          } else {
7
                              con.offsets[id] = -1;
7
                              con.offsets[id] = -1;
8
                              op = op.next;
8
                              op = op.next;
9
                              break;
9
                              break;
10
                          }
10
                          }
11
                      }
11
                      }
12
                      int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts);
12
                      int ret = this. matchString (con, op.getChild(), offset, dx, opts);
13
                      if (id >= 0)  con.offsets[id] = -1;
13
                      if (id >= 0)  con.offsets[id] = -1;
14
                      if (ret >= 0)  return ret;
14
                      if (ret >= 0)  return ret;
15
                      op = op.next;
15
                      op = op.next;
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.5
Clones locationClones are declared in the same class
Number of node comparisons55
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)58.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    208
    int id = op.getData();
    208
    int id = op.getData();
    209
    if (id >= 0)
    209
    if (id >= 0)
    210
    int previousOffset = con.offsets[id];
    210
    int previousOffset = con.offsets[id];
    211
    if (previousOffset < 0 || previousOffset != offset)
    211
    if (previousOffset < 0 || previousOffset != offset)
    212
    con.offsets[id] = offset;
    212
    con.offsets[id] = offset;
    else
    else
    213
    con.offsets[id] = -1;
    213
    con.offsets[id] = -1;
    214
    op = op.next;
    214
    op = op.next;
    215
    break;
    215
    break;
    216
    int ret = this.matchCharArray(con, op.getChild(), offset, dx, opts);
    216
    int ret = this.matchCharArray(con, op.getChild(), offset, dx, opts);
    216
    int ret = this.matchString(con, op.getChild(), offset, dx, opts);
    Differences
    Expression1Expression2Difference
    matchCharArraymatchStringMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.matchCharArray(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharArray
    Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchString
    216
    int ret = this.matchString(con, op.getChild(), offset, dx, opts);
    217
    if (id >= 0)
    217
    if (id >= 0)
    218
    con.offsets[id] = -1;
    218
    con.offsets[id] = -1;
    219
    if (ret >= 0)
    219
    if (ret >= 0)
    220
    return ret;
    220
    return ret;
    221
    op = op.next;
    221
    op = op.next;
    Precondition Violations (2)
    Row Violation
    1Expression this.matchCharArray(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted