for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target [ matchStart ] ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target [ matchStart+1 ] ); if (!range.match(ch)) continue; if (0 <= (matchEnd = this. matchCharArray (con, this.operations, matchStart, 1, this.options))) break; }
for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .setIndex( matchStart ) ; if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) ); if (!range.match(ch)) continue; if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break; }
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: boolean matches(char[], int, int, Match) Method name: boolean matches(CharacterIterator, Match)
Number of AST nodes: 8 Number of AST nodes: 8
1
for (matchStart = con.start;  matchStart <= limit;  matchStart ++) {
1
for (matchStart = con.start;  matchStart <= limit;  matchStart ++) {
2
                      int ch =  target [  matchStart ] ;
2
                      int ch =  target .setIndex(  matchStart ) ;
3
                      if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)
3
                      if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)
4
                          ch = REUtil.composeFromSurrogates(ch,  target [  matchStart+1 ] );
4
                          ch = REUtil.composeFromSurrogates(ch,  target .setIndex(  matchStart+1 ) );
5
                      if (!range.match(ch))  continue;
5
                      if (!range.match(ch))  continue;
6
                      if (0 <= (matchEnd = this. matchCharArray (con, this.operations,
6
                      if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,
7
                                                                 matchStart, 1, this.options)))
7
                                                                         matchStart, 1, this.options)))
8
                          break;
8
                          break;
9
                  }
9
                  }
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)2.0
Clones locationClones are declared in the same class
Number of node comparisons39
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    74
    for (matchStart = con.start; matchStart <= limit; matchStart++)
    76
    for (matchStart = con.start; matchStart <= limit; matchStart++)
    75
    int ch = target[matchStart];
    75
    int ch = target[matchStart];
    77
    int ch = target.setIndex(matchStart);
    Differences
    Expression1Expression2Difference
    target[matchStart]target.setIndex(matchStart)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[matchStart] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.setIndex(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    77
    int ch = target.setIndex(matchStart);
    76
    if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit)
    78
    if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit)
    77
    ch = REUtil.composeFromSurrogates(ch, target[matchStart + 1]);
    77
    ch = REUtil.composeFromSurrogates(ch, target[matchStart + 1]);
    79
    ch = REUtil.composeFromSurrogates(ch, target.setIndex(matchStart + 1));
    Differences
    Expression1Expression2Difference
    target[matchStart + 1]target.setIndex(matchStart + 1)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression target[matchStart + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.setIndex(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    79
    ch = REUtil.composeFromSurrogates(ch, target.setIndex(matchStart + 1));
    78
    if (!range.match(ch))
    80
    if (!range.match(ch))
    79
    continue;
    81
    continue;
    80
    if (0 <= (matchEnd = this.matchCharArray(con, this.operations, matchStart, 1, this.options)))
    80
    if (0 <= (matchEnd = this.matchCharArray(con, this.operations, matchStart, 1, this.options)))
    82
    if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options)))
    Differences
    Expression1Expression2Difference
    matchCharArraymatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.matchCharArray(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharArray
    Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method matchCharacterIterator
    82
    if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options)))
    81
    break;
    83
    break;
    Precondition Violations (7)
    Row Violation
    1Expression target[matchStart] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression target.setIndex(matchStart) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression target[matchStart + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression target.setIndex(matchStart + 1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression this.matchCharArray(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables matchEnd, matchStart , while Clone fragment #2 returns variables matchEnd, matchStart