11643-3-4

if (lineWidth != Integer.MAX_VALUE) { currentLineWidth += data.length(); LOOP: for (int i = data.length() - 1; i >= 0; --i) { switch (data.charAt(i)) { case '\n': case '\r': { currentLineWidth = data.length() - i; break LOOP; } } } } super.add(data);
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 addProcessingInstruction(String, String)` |  | Method name: `void addComment(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

      ↵

3

    {↵

4

          currentLineWidth += data.length();↵

4

          currentLineWidth += newString.length();↵

5

            LOOP: ↵

5

          LOOP: ↵

6

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

6

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

7

            {↵

7

          ↵

8

      ↵

8

    {↵

9

            switch (data.charAt(i))↵

9

            switch (newString.charAt(i))↵

10

              {↵

10

            {↵

11

                case '\n':↵

11

              case '\n':↵

12

                case '\r':↵

12

              case '\r':↵

13

                {↵

13

              {↵

14

                  currentLineWidth = data.length() - i;↵

14

                currentLineWidth = newString.length() - i;↵

15

                  break LOOP;↵

15

                break LOOP;↵

16

                }↵

17

              }↵

16

              }↵

18

            }↵

17

            }↵

19

          }↵

18

          }↵

20

      ↵

19

        }↵

21

        super.add(data);

20

        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.4
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.9
   Clone type | Type 2

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

   9

       if (lineWidth != Integer.MAX_VALUE)

   6

       if (lineWidth != Integer.MAX_VALUE)

   10

       currentLineWidth += data.length();

   10 | currentLineWidth += data.length();
   7 | currentLineWidth += newString.length();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   data | newString | VARIABLE_NAME_MISMATCH

   7

       currentLineWidth += newString.length();

   11

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

   11 | for (int i = data.length() - 1; i >= 0; --i)
   8 | for (int i = newString.length() - 1; i >= 0; --i)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   data | newString | VARIABLE_NAME_MISMATCH

   8

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

   12

       switch (data.charAt(i))

   12 | switch (data.charAt(i))
   9 | switch (newString.charAt(i))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   data | newString | VARIABLE_NAME_MISMATCH

   9

       switch (newString.charAt(i))

   13

       case '\n':

   10

       case '\n':

   14

       case '\r':

   11

       case '\r':

   15

       currentLineWidth = data.length() - i;

   15 | currentLineWidth = data.length() - i;
   12 | currentLineWidth = newString.length() - i;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   data | newString | VARIABLE_NAME_MISMATCH

   12

       currentLineWidth = newString.length() - i;

   16

       break LOOP;

   13

       break LOOP;

   17

       super.add(data);

   17 | super.add(data);
   14 | super.add(newString);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   data | newString | VARIABLE_NAME_MISMATCH

   14

       super.add(newString);

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