int ch = target .charAt( matchStart ) ; if (isEOLChar(ch)) { previousIsEOL = true; } else { if (previousIsEOL) { if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options))) break; } previousIsEOL = false; }
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(String, int, int, Match) Method name: boolean matches(CharacterIterator, Match)
Number of AST nodes: 7 Number of AST nodes: 7
1
int ch =  target .charAt(  matchStart ) ;
1
int ch =  target .setIndex(  matchStart ) ;
2
                      if (isEOLChar(ch)) {
2
                      if (isEOLChar(ch)) {
3
                          previousIsEOL = true;
3
                          previousIsEOL = true;
4
                      } else {
4
                      } else {
5
                          if (previousIsEOL) {
5
                          if (previousIsEOL) {
6
                              if (0 <= (matchEnd = this. matchString (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
                          }
10
                          previousIsEOL = false;
10
                          previousIsEOL = false;
11
                      }
11
                      }
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.0
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    55
    int ch = target.charAt(matchStart);
    55
    int ch = target.charAt(matchStart);
    52
    int ch = target.setIndex(matchStart);
    Differences
    Expression1Expression2Difference
    charAtsetIndexMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    • Make classes java.lang.String and java.text.CharacterIterator extend a common superclass
    52
    int ch = target.setIndex(matchStart);
    56
    if (isEOLChar(ch))
    53
    if (isEOLChar(ch))
    57
    previousIsEOL = true;
    54
    previousIsEOL = true;
    else
    else
    58
    if (previousIsEOL)
    55
    if (previousIsEOL)
    59
    if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options)))
    59
    if (0 <= (matchEnd = this.matchString(con, this.operations, matchStart, 1, this.options)))
    56
    if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options)))
    Differences
    Expression1Expression2Difference
    matchStringmatchCharacterIteratorMETHOD_INVOCATION_NAME_MISMATCH
    56
    if (0 <= (matchEnd = this.matchCharacterIterator(con, this.operations, matchStart, 1, this.options)))
    60
    break;
    60
    break;
    57
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    57
    break;
    61
    previousIsEOL = false;
    58
    previousIsEOL = false;
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target
    2Statement break; without innermost loop
    3Statement break; without innermost loop
    4Clone fragment #1 returns variables matchEnd, previousIsEOL , while Clone fragment #2 returns variables matchEnd, previousIsEOL