Op.ConditionOp cop = (Op.ConditionOp)op; boolean matchp = false; if (cop.refNumber > 0) { if (cop.refNumber >= this.nofparen) throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber); matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0; } else { matchp = 0 <= this. matchString (con, cop.condition, offset, dx, opts); } if (matchp) { op = cop.yes; } else if (cop.no != null) { op = cop.no; } else { op = cop.next; }
Op.ConditionOp cop = (Op.ConditionOp)op; boolean matchp = false; if (cop.refNumber > 0) { if (cop.refNumber >= this.nofparen) throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber); matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0; } else { matchp = 0 <= this. matchCharacterIterator (con, cop.condition, offset, dx, opts); } if (matchp) { op = cop.yes; } else if (cop.no != null) { op = cop.no; } else { op = cop.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 matchString(Context, Op, int, int, int) Method name: int matchCharacterIterator(Context, Op, int, int, int)
Number of AST nodes: 12 Number of AST nodes: 12
1
Op.ConditionOp cop = (Op.ConditionOp)op;
1
Op.ConditionOp cop = (Op.ConditionOp)op;
2
                      boolean matchp = false;
2
                      boolean matchp = false;
3
                      if (cop.refNumber > 0) {
3
                      if (cop.refNumber > 0) {
4
                          if (cop.refNumber >= this.nofparen)
4
                          if (cop.refNumber >= this.nofparen)
5
                              throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
5
                              throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
6
                          matchp = con.match.getBeginning(cop.refNumber) >= 0
6
                          matchp = con.match.getBeginning(cop.refNumber) >= 0
7
                                   && con.match.getEnd(cop.refNumber) >= 0;
7
                                   && con.match.getEnd(cop.refNumber) >= 0;
8
                      } else {
8
                      } else {
9
                          matchp = 0 <= this. matchString (con, cop.condition, offset, dx, opts);
9
                          matchp = 0 <= this. matchCharacterIterator (con, cop.condition, offset, dx, opts);
10
                      }
10
                      }
11
                      if (matchp) {
11
                      if (matchp) {
12
                          op = cop.yes;
12
                          op = cop.yes;
13
                      } else if (cop.no != null) {
13
                      } else if (cop.no != null) {
14
                          op = cop.no;
14
                          op = cop.no;
15
                      } else {
15
                      } else {
16
                          op = cop.next;
16
                          op = cop.next;
17
                      }
17
                      }
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 comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)61.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    301
    Op.ConditionOp cop = (Op.ConditionOp)op;
    301
    Op.ConditionOp cop = (Op.ConditionOp)op;
    302
    boolean matchp = false;
    302
    boolean matchp = false;
    303
    if (cop.refNumber > 0)
    303
    if (cop.refNumber > 0)
    304
    if (cop.refNumber >= this.nofparen)
    304
    if (cop.refNumber >= this.nofparen)
    305
    throw new RuntimeException("Internal Error: Reference number must be more than zero: " + cop.refNumber);
    305
    throw new RuntimeException("Internal Error: Reference number must be more than zero: " + cop.refNumber);
    306
    matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0;
    306
    matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0;
    else
    else
    307
    matchp = 0 <= this.matchString(con, cop.condition, offset, dx, opts);
    307
    matchp = 0 <= this.matchString(con, cop.condition, offset, dx, opts);
    307
    matchp = 0 <= this.matchCharacterIterator(con, cop.condition, offset, dx, opts);
    Differences
    Expression1Expression2Difference
    matchStringmatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.matchString(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchString
    Expression this.matchCharacterIterator(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharacterIterator
    307
    matchp = 0 <= this.matchCharacterIterator(con, cop.condition, offset, dx, opts);
    308
    if (matchp)
    308
    if (matchp)
    309
    op = cop.yes;
    309
    op = cop.yes;
    310
    else if (cop.no != null)
    310
    else if (cop.no != null)
    311
    op = cop.no;
    311
    op = cop.no;
    else
    else
    312
    op = cop.next;
    312
    op = cop.next;
    Precondition Violations (2)
    Row Violation
    1Expression this.matchString(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.matchCharacterIterator(con,cop.condition,offset,dx,opts) cannot be parameterized, because it has dependencies to/from statements that will be extracted