if (con.match != null && refno > 0) { int save = con.match.getBeginning(refno); con.match.setBeginning(refno, offset); int ret = this. matchCharArray (con, op.next, offset, dx, opts); if (ret < 0) con.match.setBeginning(refno, save); return ret; } else if (con.match != null && refno < 0) { int index = -refno; int save = con.match.getEnd(index); con.match.setEnd(index, offset); int ret = this. matchCharArray (con, op.next, offset, dx, opts); if (ret < 0) con.match.setEnd(index, save); return ret; }
if (con.match != null && refno > 0) { int save = con.match.getBeginning(refno); con.match.setBeginning(refno, offset); int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts); if (ret < 0) con.match.setBeginning(refno, save); return ret; } else if (con.match != null && refno < 0) { int index = -refno; int save = con.match.getEnd(index); con.match.setEnd(index, offset); int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts); if (ret < 0) con.match.setEnd(index, save); return ret; }
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 matchCharacterIterator(Context, Op, int, int, int)
Number of AST nodes: 15 Number of AST nodes: 15
1
if (con.match != null && refno > 0) {
1
if (con.match != null && refno > 0) {
2
                      int save = con.match.getBeginning(refno);
2
                      int save = con.match.getBeginning(refno);
3
                      con.match.setBeginning(refno, offset);
3
                      con.match.setBeginning(refno, offset);
4
                      int ret = this. matchCharArray (con, op.next, offset, dx, opts);
4
                      int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);
5
                      if (ret < 0)  con.match.setBeginning(refno, save);
5
                      if (ret < 0)  con.match.setBeginning(refno, save);
6
                      return ret;
6
                      return ret;
7
                  } else if (con.match != null && refno < 0) {
7
                  } else if (con.match != null && refno < 0) {
8
                      int index = -refno;
8
                      int index = -refno;
9
                      int save = con.match.getEnd(index);
9
                      int save = con.match.getEnd(index);
10
                      con.match.setEnd(index, offset);
10
                      con.match.setEnd(index, offset);
11
                      int ret = this. matchCharArray (con, op.next, offset, dx, opts);
11
                      int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);
12
                      if (ret < 0)  con.match.setEnd(index, save);
12
                      if (ret < 0)  con.match.setEnd(index, save);
13
                      return ret;
13
                      return ret;
14
                  }
14
                  }
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 comparisons77
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)60.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    246
    if (con.match != null && refno > 0)
    246
    if (con.match != null && refno > 0)
    247
    int save = con.match.getBeginning(refno);
    247
    int save = con.match.getBeginning(refno);
    248
    con.match.setBeginning(refno, offset);
    248
    con.match.setBeginning(refno, offset);
    249
    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
    249
    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
    249
    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
    Differences
    Expression1Expression2Difference
    matchCharArraymatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.matchCharArray(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharArray
    Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharacterIterator
    249
    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
    250
    if (ret < 0)
    250
    if (ret < 0)
    251
    con.match.setBeginning(refno, save);
    251
    con.match.setBeginning(refno, save);
    252
    return ret;
    252
    return ret;
    253
    else if (con.match != null && refno < 0)
    253
    else if (con.match != null && refno < 0)
    254
    int index = -refno;
    254
    int index = -refno;
    255
    int save = con.match.getEnd(index);
    255
    int save = con.match.getEnd(index);
    256
    con.match.setEnd(index, offset);
    256
    con.match.setEnd(index, offset);
    257
    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
    257
    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
    257
    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
    Differences
    Expression1Expression2Difference
    matchCharArraymatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.matchCharArray(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharArray
    Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharacterIterator
    257
    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
    258
    if (ret < 0)
    258
    if (ret < 0)
    259
    con.match.setEnd(index, save);
    259
    con.match.setEnd(index, save);
    260
    return ret;
    260
    return ret;
    Precondition Violations (4)
    Row Violation
    1Expression this.matchCharArray(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression this.matchCharArray(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression this.matchCharacterIterator(con,op.next,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted