if (isSet(opts, SINGLE_LINE)) { if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) o1 --; } else { if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch); if (!isEOLChar(ch)) return -1; }
if (isSet(opts, SINGLE_LINE)) { if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) o1 --; } else { if (REUtil.isLowSurrogate(ch) && o1-1 >= 0) ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch); if (!isEOLChar(ch)) return -1; }
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: 7 Number of AST nodes: 7
1
if (isSet(opts, SINGLE_LINE)) {
1
if (isSet(opts, SINGLE_LINE)) {
2
                          if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
2
                          if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
3
                              o1 --;
3
                              o1 --;
4
                      } else {
4
                      } else {
5
                          if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
5
                          if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
6
                              ch = REUtil.composeFromSurrogates( target .charAt(  --o1 ) , ch);
6
                              ch = REUtil.composeFromSurrogates( target .setIndex(  --o1 ) , ch);
7
                          if (!isEOLChar(ch))
7
                          if (!isEOLChar(ch))
8
                              return -1;
8
                              return -1;
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)1.6
Clones locationClones are declared in the same class
Number of node comparisons35
  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)4.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    47
    if (isSet(opts, SINGLE_LINE))
    47
    if (isSet(opts, SINGLE_LINE))
    48
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    48
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    49
    o1--;
    49
    o1--;
    else
    else
    50
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    50
    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0)
    51
    ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
    51
    ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
    51
    ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch);
    Differences
    Expression1Expression2Difference
    charAtsetIndexMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.text.CharacterIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression target.setIndex(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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
    51
    ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch);
    52
    if (!isEOLChar(ch))
    52
    if (!isEOLChar(ch))
    53
    return -1;
    53
    return -1;
    Precondition Violations (3)
    Row Violation
    1Expression target.charAt(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression target.setIndex(--o1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.lang.String of variable target does not match with type java.text.CharacterIterator of variable target