11643-1-2

if (lineWidth != Integer.MAX_VALUE) { currentLineWidth += newString.length(); LOOP: for (int i = newString.length() - 1; i >= 0; --i) { switch (newString.charAt(i)) { case '\n': case '\r': { currentLineWidth = newString.length() - i; break LOOP; } } } } super.add(newString);
if (lineWidth != Integer.MAX_VALUE) { currentLineWidth += newString.length(); LOOP: for (int i = newString.length() - 1; i >= 0; --i) { switch (newString.charAt(i)) { case '\n': case '\r': { currentLineWidth = newString.length() - i; break LOOP; } } } } super.add(newString);

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLString.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLString.java
Method name: `void addText(String)` |  | Method name: `void addCDATA(String)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    if (lineWidth != Integer.MAX_VALUE)↵

1

    if (lineWidth != Integer.MAX_VALUE)↵

2

        {↵

2

        {↵

3

          currentLineWidth += newString.length();↵

3

          currentLineWidth += newString.length();↵

4

          LOOP: for (int i = newString.length() - 1; i >= 0; --i)↵

4

          LOOP: for (int i = newString.length() - 1; i >= 0; --i)↵

5

          {↵

5

          {↵

6

            switch (newString.charAt(i))↵

6

            switch (newString.charAt(i))↵

7

            {↵

7

            {↵

8

              case '\n':↵

8

              case '\n':↵

9

              case '\r':↵

9

              case '\r':↵

10

              {↵

10

              {↵

11

                currentLineWidth = newString.length() - i;↵

11

                currentLineWidth = newString.length() - i;↵

12

                break LOOP;↵

12

                break LOOP;↵

13

              }↵

13

              }↵

14

            }↵

14

            }↵

15

          }↵

15

          }↵

16

        }↵

16

        }↵

17

        super.add(newString);

17

        super.add(newString);

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.3
Clones location | Clones are declared in the same class
Number of node comparisons | 20

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 9
   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.7
   Clone type | Type 1

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

   3

       if (lineWidth != Integer.MAX_VALUE)

   4

       if (lineWidth != Integer.MAX_VALUE)

   4

       currentLineWidth += newString.length();

   5

       currentLineWidth += newString.length();

   5

       for (int i = newString.length() - 1; i >= 0; --i)

   6

       for (int i = newString.length() - 1; i >= 0; --i)

   6

       switch (newString.charAt(i))

   7

       switch (newString.charAt(i))

   7

       case '\n':

   8

       case '\n':

   8

       case '\r':

   9

       case '\r':

   9

       currentLineWidth = newString.length() - i;

   10

       currentLineWidth = newString.length() - i;

   10

       break LOOP;

   11

       break LOOP;

   11

       super.add(newString);

   12

       super.add(newString);

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