max = ch -'0'; // {min,max} while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') { max = max*10 +ch-'0'; if (max < 0) throw ex("parser.quantifier.5", this.offset); } if (min > max) throw ex("parser.quantifier.4", this.offset);
min = ch -'0'; while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') { min = min*10 +ch-'0'; if (min < 0) throw ex("parser.quantifier.5", this.offset); }
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: Token parseFactor() Method name: Token parseFactor()
Number of AST nodes: 7 Number of AST nodes: 5
1
max = ch -'0';       // {min,max}
1
min = ch -'0';
2
    
3
                      while (off < this.regexlen
2
                      while (off < this.regexlen
4
                                 && (ch = this.regex.charAt(off++)) >= '0'
3
                             && (ch = this.regex.charAt(off++)) >= '0'
5
                                 && ch <= '9') {
4
 && ch <= '9') {
6
                              max = max*10 +ch-'0';
5
                          min = min*10 +ch-'0';
7
                              if (max < 0)
6
                          if (min < 0)
8
                                  throw ex("parser.quantifier.5", this.offset);
7
                              throw ex("parser.quantifier.5", this.offset);
9
                          }
8
                      
10
                          if (min > max)
11
                              throw ex("parser.quantifier.4", this.offset);
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)0.7
Clones locationClones are in the same method
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    60
    max = ch - '0';
    60
    max = ch - '0';
    49
    min = ch - '0';
    Differences
    Expression1Expression2Difference
    maxminVARIABLE_NAME_MISMATCH
    49
    min = ch - '0';
    61
    while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9')
    50
    while (off < this.regexlen && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9')
    62
    max = max * 10 + ch - '0';
    62
    max = max * 10 + ch - '0';
    51
    min = min * 10 + ch - '0';
    Differences
    Expression1Expression2Difference
    maxminVARIABLE_NAME_MISMATCH
    maxminVARIABLE_NAME_MISMATCH
    51
    min = min * 10 + ch - '0';
    63
    if (max < 0)
    63
    if (max < 0)
    52
    if (min < 0)
    Differences
    Expression1Expression2Difference
    maxminVARIABLE_NAME_MISMATCH
    52
    if (min < 0)
    64
    throw ex("parser.quantifier.5", this.offset);
    53
    throw ex("parser.quantifier.5", this.offset);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables max, ch, off , while Clone fragment #2 returns variables min, ch, off