1738-1-2

RangeToken tok = (RangeToken)token; if (tok.ranges == null || this.ranges == null) return; this.icaseCache = null; this.sortRanges(); this.compactRanges(); tok.sortRanges(); tok.compactRanges(); int[] result = new int[this.ranges.length+tok.ranges.length]; int wp = 0, src1 = 0, src2 = 0;
RangeToken tok = (RangeToken)token; if (tok.ranges == null || this.ranges == null) return; this.icaseCache = null; this.sortRanges(); this.compactRanges(); tok.sortRanges(); tok.compactRanges(); //System.err.println("Token#substractRanges(): Entry: "+this.ranges.length+", "+tok.ranges.length); int[] result = new int[this.ranges.length+tok.ranges.length]; int wp = 0, src = 0, sub = 0;

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 intersectRanges(Token)` |  | Method name: `void subtractRanges(Token)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    RangeToken tok = (RangeToken)token;↵

1

    RangeToken tok = (RangeToken)token;↵

2

            if (tok.ranges == null || this.ranges == null)↵

2

            if (tok.ranges == null || this.ranges == null)↵

3

                return;↵

3

                return;↵

4

            this.icaseCache = null;↵

4

            this.icaseCache = null;↵

5

            this.sortRanges();↵

5

            this.sortRanges();↵

6

            this.compactRanges();↵

6

            this.compactRanges();↵

7

            tok.sortRanges();↵

7

            tok.sortRanges();↵

8

            tok.compactRanges();↵

8

            tok.compactRanges();↵

9

            //System.err.println("Token#substractRanges(): Entry: "+this.ranges.length+", "+tok.ranges.length);↵

9

            int[] result = new int[this.ranges.length+tok.ranges.length];↵

10

            int[] result = new int[this.ranges.length+tok.ranges.length];↵

10

            int wp = 0, src1 = 0, src2 = 0;

11

            int wp = 0, src = 0, sub = 0;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6
Clones location | Clones are declared in the same class
Number of node comparisons | 37

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 10
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 3.8
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       RangeToken tok = (RangeToken)token;

   4

       RangeToken tok = (RangeToken)token;

   2

       if (tok.ranges == null || this.ranges == null)

   5

       if (tok.ranges == null || this.ranges == null)

   3

       return;

   3 | return;
   6 | return;

   Preondition Violations
   Conditional return;
   Conditional return;

   6

       return;

   4

       this.icaseCache = null;

   7

       this.icaseCache = null;

   5

       this.sortRanges();

   8

       this.sortRanges();

   6

       this.compactRanges();

   9

       this.compactRanges();

   7

       tok.sortRanges();

   10

       tok.sortRanges();

   8

       tok.compactRanges();

   11

       tok.compactRanges();

   9

       int[] result = new int[this.ranges.length + tok.ranges.length];

   12

       int[] result = new int[this.ranges.length + tok.ranges.length];

   10

       int wp = 0, src1 = 0, src2 = 0;

   10 | int wp = 0, src1 = 0, src2 = 0;
   13 | int wp = 0, src = 0, sub = 0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   src1 | src | VARIABLE_NAME_MISMATCH
   src2 | sub | VARIABLE_NAME_MISMATCH

   13

       int wp = 0, src = 0, sub = 0;

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Conditional return;
   2 | Conditional return;
   3 | Clone fragment #1 returns variables tok, src1, src2, result, wp , while Clone fragment #2 returns variables tok, src, sub, result, wp