if (subend < srcbegin) { // Not overlapped // src: o-----o // sub: o----o sub += 2; } else { throw new RuntimeException("Token#subtractRanges(): Internal Error: ["+this.ranges[src] +","+this.ranges[src+1] +"] - ["+tok.ranges[sub] +","+tok.ranges[sub+1] +"]"); }
if (src2end < src1begin) { // Not overlapped // src1: o-----o // src2: o----o src2 += 2; } else { throw new RuntimeException("Token#intersectRanges(): Internal Error: [" +this.ranges[src1] +","+this.ranges[src1+1] +"] & ["+tok.ranges[src2] +","+tok.ranges[src2+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: void subtractRanges(Token) Method name: void intersectRanges(Token)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (subend < srcbegin) {
1
if (src2end < src1begin) {
2
                                                // Not overlapped
2
                                                // Not overlapped
3
                                                // src:          o-----o
3
                                                // src1:          o-----o
4
                                                // sub: o----o
4
                                                // src2: o----o
5
                sub += 2;
5
                src2 += 2;
6
            } else {
6
            } else {
7
                throw new RuntimeException("Token#subtractRanges(): Internal Error: ["
7
                throw new RuntimeException("Token#intersectRanges(): Internal Error: ["
8
+this.ranges[src]
8
                                           +this.ranges[src1]
9
                                           +","+this.ranges[src+1]
9
                                           +","+this.ranges[src1+1]
10
                                           +"] - ["+tok.ranges[sub]
10
                                           +"] & ["+tok.ranges[src2]
11
                                           +","+tok.ranges[sub+1]
11
                                           +","+tok.ranges[src2+1]
12
                                           +"]");
12
                                           +"]");
13
            }
13
            }
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)0.4
Clones locationClones are declared in the same class
Number of node comparisons10
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    36
    else if (subend < srcbegin)
    36
    else if (subend < srcbegin)
    35
    else if (src2end < src1begin)
    Differences
    Expression1Expression2Difference
    subendsrc2endVARIABLE_NAME_MISMATCH
    srcbeginsrc1beginVARIABLE_NAME_MISMATCH
    35
    else if (src2end < src1begin)
    37
    sub += 2;
    37
    sub += 2;
    36
    src2 += 2;
    Differences
    Expression1Expression2Difference
    subsrc2VARIABLE_NAME_MISMATCH
    36
    src2 += 2;
    else
    else
    38
    throw new RuntimeException("Token#subtractRanges(): Internal Error: [" + this.ranges[src] + "," + this.ranges[src + 1] + "] - [" + tok.ranges[sub] + "," + tok.ranges[sub + 1] + "]");
    38
    throw new RuntimeException("Token#subtractRanges(): Internal Error: [" + this.ranges[src] + "," + this.ranges[src + 1] + "] - [" + tok.ranges[sub] + "," + tok.ranges[sub + 1] + "]");
    37
    throw new RuntimeException("Token#intersectRanges(): Internal Error: [" + this.ranges[src1] + "," + this.ranges[src1 + 1] + "] & [" + tok.ranges[src2] + "," + tok.ranges[src2 + 1] + "]");
    Differences
    Expression1Expression2Difference
    srcsrc1VARIABLE_NAME_MISMATCH
    "] - [""] & ["LITERAL_VALUE_MISMATCH
    subsrc2VARIABLE_NAME_MISMATCH
    subsrc2VARIABLE_NAME_MISMATCH
    "Token#subtractRanges(): Internal Error: [""Token#intersectRanges(): Internal Error: ["LITERAL_VALUE_MISMATCH
    srcsrc1VARIABLE_NAME_MISMATCH
    37
    throw new RuntimeException("Token#intersectRanges(): Internal Error: [" + this.ranges[src1] + "," + this.ranges[src1 + 1] + "] & [" + tok.ranges[src2] + "," + tok.ranges[src2 + 1] + "]");
    Precondition Violations (0)
    Row Violation