12010-1-2

case DOT: case RANGE: case NRANGE: return 2; case INDEPENDENT: case PAREN: case MODIFIERGROUP: return this.getChild(0).getMaxLength(); case BACKREFERENCE: return -1; // ****** case STRING: return this.getString().length(); case LOOKAHEAD: case NEGATIVELOOKAHEAD: case LOOKBEHIND: case NEGATIVELOOKBEHIND: return 0; // ***** Really? default: throw new RuntimeException("Token#getMaxLength(): Invalid Type: "+this.type);
case CHAR: case RANGE: case NRANGE: return 1; case INDEPENDENT: case PAREN: case MODIFIERGROUP: return this.getChild(0).getMinLength(); case BACKREFERENCE: return 0; // ******* case STRING: return this.getString().length(); case LOOKAHEAD: case NEGATIVELOOKAHEAD: case LOOKBEHIND: case NEGATIVELOOKBEHIND: return 0; // ***** Really? default: throw new RuntimeException("Token#getMinLength(): Invalid Type: "+this.type);

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 getMaxLength()` |  | Method name: `int getMinLength()`
Number of AST nodes: 19 |  | Number of AST nodes: 19

1

    case DOT:↵

1

    case CHAR:↵

2

                case RANGE:↵

2

                case RANGE:↵

3

                case NRANGE:↵

3

                case NRANGE:↵

4

                  return 2;↵

4

                  return 1;↵

5

                case INDEPENDENT:↵

5

                case INDEPENDENT:↵

6

                case PAREN:↵

6

                case PAREN:↵

7

                case MODIFIERGROUP:↵

7

                case MODIFIERGROUP:↵

8

                  return this.getChild(0).getMaxLength();↵

8

                  return this.getChild(0).getMinLength();↵

9

                case BACKREFERENCE:↵

9

                case BACKREFERENCE:↵

10

                  return -1;                          // ******↵

10

                  return 0;                           // *******↵

11

                case STRING:↵

11

                case STRING:↵

12

                  return this.getString().length();↵

12

                  return this.getString().length();↵

13

                case LOOKAHEAD:↵

13

                case LOOKAHEAD:↵

14

                case NEGATIVELOOKAHEAD:↵

14

                case NEGATIVELOOKAHEAD:↵

15

                case LOOKBEHIND:↵

15

                case LOOKBEHIND:↵

16

                case NEGATIVELOOKBEHIND:↵

16

                case NEGATIVELOOKBEHIND:↵

17

                  return 0;                           // ***** Really?↵

17

                  return 0;                           // ***** Really?↵

18

                default:↵

18

                default:↵

19

                  throw new RuntimeException("Token#getMaxLength(): Invalid Type: "+this.type);

19

                  throw new RuntimeException("Token#getMinLength(): Invalid Type: "+this.type);

See real code fragment |  | See real code fragment

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 19
   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) | 0.0
   Clone type | Type 2

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

   33

       case DOT:

   33 | case DOT:
   32 | case MODIFIERGROUP:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   DOT | MODIFIERGROUP | VARIABLE_NAME_MISMATCH

   32

       case MODIFIERGROUP:

   34

       case RANGE:

   27

       case RANGE:

   35

       case NRANGE:

   28

       case NRANGE:

   36

       return 2;

   36 | return 2;
   29 | return 1;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   2 | 1 | LITERAL_VALUE_MISMATCH

   29

       return 1;

   37

       case INDEPENDENT:

   30

       case INDEPENDENT:

   38

       case PAREN:

   31

       case PAREN:

   39

       case MODIFIERGROUP:

   39 | case MODIFIERGROUP:
   41 | case NEGATIVELOOKBEHIND:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   MODIFIERGROUP | NEGATIVELOOKBEHIND | VARIABLE_NAME_MISMATCH

   41

       case NEGATIVELOOKBEHIND:

   40

       return this.getChild(0).getMaxLength();

   40 | return this.getChild(0).getMaxLength();
   42 | return 0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this.getChild(0).getMaxLength() | 0 | TYPE_COMPATIBLE_REPLACEMENT

   42

       return 0;

   41

       case BACKREFERENCE:

   34

       case BACKREFERENCE:

   42

       return -1;

   42 | return -1;
   35 | return 0;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   -1 | 0 | TYPE_COMPATIBLE_REPLACEMENT

   35

       return 0;

   43

       case STRING:

   36

       case STRING:

   44

       return this.getString().length();

   37

       return this.getString().length();

   45

       case LOOKAHEAD:

   38

       case LOOKAHEAD:

   46

       case NEGATIVELOOKAHEAD:

   39

       case NEGATIVELOOKAHEAD:

   47

       case LOOKBEHIND:

   40

       case LOOKBEHIND:

   48

       case NEGATIVELOOKBEHIND:

   48 | case NEGATIVELOOKBEHIND:
   26 | case CHAR:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   NEGATIVELOOKBEHIND | CHAR | VARIABLE_NAME_MISMATCH

   26

       case CHAR:

   49

       return 0;

   49 | return 0;
   33 | return this.getChild(0).getMinLength();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0 | this.getChild(0).getMinLength() | TYPE_COMPATIBLE_REPLACEMENT

   33

       return this.getChild(0).getMinLength();

   50

       default:

   43

       default:

   51

       throw new RuntimeException("Token#getMaxLength(): Invalid Type: " + this.type);

   51 | throw new RuntimeException("Token#getMaxLength(): Invalid Type: " + this.type);
   44 | throw new RuntimeException("Token#getMinLength(): Invalid Type: " + this.type);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Token#getMaxLength(): Invalid Type: " | "Token#getMinLength(): Invalid Type: " | LITERAL_VALUE_MISMATCH

   44

       throw new RuntimeException("Token#getMinLength(): Invalid Type: " + this.type);

   Precondition Violations (0)
   Row | Violation
   --- | ---