if (isSet(this.options, SINGLE_LINE)) { matchStart = con.start; matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options); } else { boolean previousIsEOL = true; for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target [ matchStart ] ; if (isEOLChar(ch)) { previousIsEOL = true; } else { if (previousIsEOL) { if (0 <= (matchEnd = this. matchCharArray (con, this.operations, matchStart, 1, this.options))) break; } previousIsEOL = false; } } }
if (isSet(this.options, SINGLE_LINE)) { matchStart = con.start; matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options); } else { boolean previousIsEOL = true; for (matchStart = con.start; matchStart <= limit; matchStart ++) { int ch = target .setIndex( matchStart ) ; if (isEOLChar(ch)) { previousIsEOL = true; } else { if (previousIsEOL) { if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options))) break; } previousIsEOL = false; } } }
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: 12 Number of AST nodes: 12
1
if (isSet(this.options, SINGLE_LINE)) {
1
if (isSet(this.options, SINGLE_LINE)) {
2
                  matchStart = con.start;
2
                  matchStart = con.start;
3
                  matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options);
3
                  matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options);
4
              } else {
4
              } else {
5
                  boolean previousIsEOL = true;
5
                  boolean previousIsEOL = true;
6
                  for (matchStart = con.start;  matchStart <= limit;  matchStart ++) {
6
                  for (matchStart = con.start;  matchStart <= limit;  matchStart ++) {
7
                      int ch =  target [  matchStart ] ;
7
                      int ch =  target .setIndex(  matchStart ) ;
8
                      if (isEOLChar(ch)) {
8
                      if (isEOLChar(ch)) {
9
                          previousIsEOL = true;
9
                          previousIsEOL = true;
10
                      } else {
10
                      } else {
11
                          if (previousIsEOL) {
11
                          if (previousIsEOL) {
12
                              if (0 <= (matchEnd = this. matchCharArray (con, this.operations,
12
                              if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,
13
                                                                         matchStart, 1, this.options)))
13
                                                                                 matchStart, 1, this.options)))
14
                                  break;
14
                                  break;
15
                          }
15
                          }
16
                          previousIsEOL = false;
16
                          previousIsEOL = false;
17
                      }
17
                      }
18
                  }
18
                  }
19
              }
19
              }
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)1.2
Clones locationClones are declared in the same class
Number of node comparisons35
  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)4.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    45
    if (isSet(this.options, SINGLE_LINE))
    47
    if (isSet(this.options, SINGLE_LINE))
    46
    matchStart = con.start;
    48
    matchStart = con.start;
    47
    matchEnd = this.matchCharArray(con, this.operations, con.start, 1, this.options);
    47
    matchEnd = this.matchCharArray(con, this.operations, con.start, 1, this.options);
    49
    matchEnd = this.matchCharacterIterator(con, this.operations, con.start, 1, this.options);
    Differences
    Expression1Expression2Difference
    matchCharArraymatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    49
    matchEnd = this.matchCharacterIterator(con, this.operations, con.start, 1, this.options);
    else
    else
    48
    boolean previousIsEOL = true;
    50
    boolean previousIsEOL = true;
    49
    for (matchStart = con.start; matchStart <= limit; matchStart++)
    51
    for (matchStart = con.start; matchStart <= limit; matchStart++)
    50
    int ch = target[matchStart];
    50
    int ch = target[matchStart];
    52
    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
    52
    int ch = target.setIndex(matchStart);
    51
    if (isEOLChar(ch))
    53
    if (isEOLChar(ch))
    52
    previousIsEOL = true;
    54
    previousIsEOL = true;
    else
    else
    53
    if (previousIsEOL)
    55
    if (previousIsEOL)
    54
    if (0 <= (matchEnd = this.matchCharArray(con, this.operations, matchStart, 1, this.options)))
    54
    if (0 <= (matchEnd = this.matchCharArray(con, this.operations, matchStart, 1, this.options)))
    56
    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
    56
    if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options)))
    55
    break;
    57
    break;
    56
    previousIsEOL = false;
    58
    previousIsEOL = false;
    Precondition Violations (5)
    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 this.matchCharArray(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression this.matchCharacterIterator(con,this.operations,matchStart,1,this.options) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables matchEnd, matchStart , while Clone fragment #2 returns variables matchEnd, matchStart