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 += 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);
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 addProcessingInstruction(String, 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
      currentLineWidth += newString.length();
4
        currentLineWidth += data.length();
4
      LOOP: 
5
        LOOP: 
5
for (int i = newString.length() - 1; i >= 0; --i)
6
        for (int i = data.length() - 1; i >= 0; --i)
6
      {
7
      
8
  {
7
        switch (newString.charAt(i))
9
          switch (data.charAt(i))
8
        {
10
          {
9
          case '\n':
11
            case '\n':
10
          case '\r':
12
            case '\r':
11
          {
13
            {
12
            currentLineWidth = newString.length() - i;
14
              currentLineWidth = data.length() - i;
13
            break LOOP;
15
              break LOOP;
16
            }
14
          }
17
          }
15
        }
18
        }
16
      }
19
      }
17
    }
20
 
18
    super.add(newString);
21
     super.add(data);
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 comparisons20
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    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.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (lineWidth != Integer.MAX_VALUE)
    9
    if (lineWidth != Integer.MAX_VALUE)
    4
    currentLineWidth += newString.length();
    4
    currentLineWidth += newString.length();
    10
    currentLineWidth += data.length();
    Differences
    Expression1Expression2Difference
    newStringdataVARIABLE_NAME_MISMATCH
    10
    currentLineWidth += data.length();
    5
    for (int i = newString.length() - 1; i >= 0; --i)
    5
    for (int i = newString.length() - 1; i >= 0; --i)
    11
    for (int i = data.length() - 1; i >= 0; --i)
    Differences
    Expression1Expression2Difference
    newStringdataVARIABLE_NAME_MISMATCH
    11
    for (int i = data.length() - 1; i >= 0; --i)
    6
    switch (newString.charAt(i))
    6
    switch (newString.charAt(i))
    12
    switch (data.charAt(i))
    Differences
    Expression1Expression2Difference
    newStringdataVARIABLE_NAME_MISMATCH
    12
    switch (data.charAt(i))
    7
    case '\n':
    13
    case '\n':
    8
    case '\r':
    14
    case '\r':
    9
    currentLineWidth = newString.length() - i;
    9
    currentLineWidth = newString.length() - i;
    15
    currentLineWidth = data.length() - i;
    Differences
    Expression1Expression2Difference
    newStringdataVARIABLE_NAME_MISMATCH
    15
    currentLineWidth = data.length() - i;
    10
    break LOOP;
    16
    break LOOP;
    11
    super.add(newString);
    11
    super.add(newString);
    17
    super.add(data);
    Differences
    Expression1Expression2Difference
    newStringdataVARIABLE_NAME_MISMATCH
    17
    super.add(data);
    Precondition Violations (0)
    Row Violation