107-1-3

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. matchCharacterIterator (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 matchCharacterIterator(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

                          ↵

13

                          int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);↵

12

                          int ret = this. matchString (con, op.getChild(), offset, dx, opts);↵

14

                          if (id >= 0)  con.offsets[id] = -1;↵

13

                          if (id >= 0)  con.offsets[id] = -1;↵

15

                          if (ret >= 0)  return ret;↵

14

                          if (ret >= 0)  return ret;↵

16

                          op = op.next;

15

                          op = op.next;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7
Clones location | Clones are declared in the same class
Number of node comparisons | 55

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 14
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 198.8
   Clone type | Type 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;
   215 | break;

   Preondition Violations
   Statement break; without innermost loop
   Statement break; without innermost loop

   215

       break;

   216

       int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts);

   216 | int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts);
   216 | int ret = this.matchString(con, op.getChild(), offset, dx, opts);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   matchCharacterIterator | matchString | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations

   Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   - Inline private method matchCharacterIterator

   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 (5)
   Row | Violation
   --- | ---
   1 | Statement break; without innermost loop
   2 | Statement break; without innermost loop
   3 | Expression this.matchCharacterIterator(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression this.matchString(con,op.getChild(),offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Not all possible execution flows end in a return statement