StringBuffer sb = new StringBuffer(); sb.append("["); for (int i = 0; i < this.ranges.length; i += 2) { if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(","); if (this.ranges[i] == this.ranges[i+1]) { sb.append(escapeCharInCharClass(this.ranges[i])); } else { sb.append(escapeCharInCharClass(this.ranges[i])); sb.append('-'); sb.append(escapeCharInCharClass(this.ranges[i+1])); } } sb.append("]"); ret = sb.toString();
StringBuffer sb = new StringBuffer(); sb.append("[^"); for (int i = 0; i < this.ranges.length; i += 2) { if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(","); if (this.ranges[i] == this.ranges[i+1]) { sb.append(escapeCharInCharClass(this.ranges[i])); } else { sb.append(escapeCharInCharClass(this.ranges[i])); sb.append('-'); sb.append(escapeCharInCharClass(this.ranges[i+1])); } } sb.append("]"); ret = sb.toString();
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: String toString(int) Method name: String toString(int)
Number of AST nodes: 12 Number of AST nodes: 12
1
StringBuffer sb = new StringBuffer();
1
StringBuffer sb = new StringBuffer();
2
                sb.append("[");
2
                sb.append("[^");
3
                for (int i = 0;  i < this.ranges.length;  i += 2) {
3
                for (int i = 0;  i < this.ranges.length;  i += 2) {
4
                    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0)  sb.append(",");
4
                    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0)  sb.append(",");
5
                    if (this.ranges[i] == this.ranges[i+1]) {
5
                    if (this.ranges[i] == this.ranges[i+1]) {
6
                        sb.append(escapeCharInCharClass(this.ranges[i]));
6
                        sb.append(escapeCharInCharClass(this.ranges[i]));
7
                    } else {
7
                    } else {
8
                        sb.append(escapeCharInCharClass(this.ranges[i]));
8
                        sb.append(escapeCharInCharClass(this.ranges[i]));
9
                        sb.append('-');
9
                        sb.append('-');
10
                        sb.append(escapeCharInCharClass(this.ranges[i+1]));
10
                        sb.append(escapeCharInCharClass(this.ranges[i+1]));
11
                    }
11
                    }
12
                }
12
                }
13
                sb.append("]");
13
                sb.append("]");
14
                ret = sb.toString();
14
                ret = sb.toString();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.0
Clones locationClones are in the same method
Number of node comparisons52
  1. {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)6.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    StringBuffer sb = new StringBuffer();
    29
    StringBuffer sb = new StringBuffer();
    12
    sb.append("[");
    12
    sb.append("[");
    30
    sb.append("[^");
    Differences
    Expression1Expression2Difference
    "[""[^"LITERAL_VALUE_MISMATCH
    30
    sb.append("[^");
    13
    for (int i = 0; i < this.ranges.length; i += 2)
    31
    for (int i = 0; i < this.ranges.length; i += 2)
    14
    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0)
    32
    if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0)
    15
    sb.append(",");
    33
    sb.append(",");
    16
    if (this.ranges[i] == this.ranges[i + 1])
    34
    if (this.ranges[i] == this.ranges[i + 1])
    17
    sb.append(escapeCharInCharClass(this.ranges[i]));
    35
    sb.append(escapeCharInCharClass(this.ranges[i]));
    else
    else
    18
    sb.append(escapeCharInCharClass(this.ranges[i]));
    36
    sb.append(escapeCharInCharClass(this.ranges[i]));
    19
    sb.append('-');
    37
    sb.append('-');
    20
    sb.append(escapeCharInCharClass(this.ranges[i + 1]));
    38
    sb.append(escapeCharInCharClass(this.ranges[i + 1]));
    21
    sb.append("]");
    39
    sb.append("]");
    22
    ret = sb.toString();
    40
    ret = sb.toString();
    Precondition Violations (0)
    Row Violation