if (lastElementIsStart) { closeStartElement(); } saveDoctype(name); ++depth; if (!isMixed) { add(getElementIndent()); } add("<"); add(name); if (firstElementMark == null) { firstElementMark = mark(); startFileBuffering(); } if (currentLineWidth > lineWidth) { addLine(); add(getAttributeIndent()); } else { add(" "); } add("xsi:nil=\"true\"/>"); --depth; if (!isUnformatted && !isMixed) { addLine(); } lastElementIsStart = false;
if (lastElementIsStart) { closeStartElement(); } saveDoctype(name); ++depth; if (!isMixed) { add(getElementIndent()); } add("<"); add(name); if (firstElementMark == null) { firstElementMark = mark(); startFileBuffering(); } add(">"); add(content); add("</"); --depth; add(name); add(">"); if (!isUnformatted && !isMixed) { addLine(); } lastElementIsStart = false;
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 saveNilElement(String) Method name: void saveDataValueElement(String, String)
Number of AST nodes: 20 Number of AST nodes: 20
1
if (lastElementIsStart)
1
if (lastElementIsStart)
2
    {
2
    {
3
      closeStartElement();
3
      closeStartElement();
4
    }
4
    }
5
    saveDoctype(name);
5
    saveDoctype(name);
6
    ++depth;
6
    ++depth;
7
    if (!isMixed)
7
    if (!isMixed)
8
    {
8
    {
9
      add(getElementIndent());
9
      add(getElementIndent());
10
    }
10
    }
11
    add("<");
11
    add("<");
12
    add(name);
12
    add(name);
13
    if (firstElementMark == null)
13
    if (firstElementMark == null)
14
    {
14
    {
15
      firstElementMark = mark();
15
      firstElementMark = mark();
16
      startFileBuffering();
16
      startFileBuffering();
17
    }
17
    }
18
    if (currentLineWidth > lineWidth)
18
    
19
    {
20
      addLine(
19
add(">");
21
);
20
    add(content);
22
      add(getAttributeIndent());
21
    add(
23
    }
24
    else
25
    {
26
      add(" ");
27
    }
28
    add("xsi:nil=\"true\"/>");
29
    --depth;
22
"</");
23
    --depth;
24
    add(name);
25
    add(">");
30
    if (!isUnformatted && !isMixed)
26
    if (!isUnformatted && !isMixed)
31
    {
27
    {
32
      addLine();
28
      addLine();
33
    }
29
    }
34
    lastElementIsStart = false;
30
    lastElementIsStart = false;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.7
Clones locationClones are declared in the same class
Number of node comparisons138
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)22.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (lastElementIsStart)
    1
    if (lastElementIsStart)
    2
    closeStartElement();
    2
    closeStartElement();
    3
    saveDoctype(name);
    3
    saveDoctype(name);
    4
    ++depth;
    4
    ++depth;
    5
    if (!isMixed)
    5
    if (!isMixed)
    6
    add(getElementIndent());
    6
    add(getElementIndent());
    7
    add("<");
    7
    add("<");
    8
    add(name);
    8
    add(name);
    9
    if (firstElementMark == null)
    9
    if (firstElementMark == null)
    10
    firstElementMark = mark();
    10
    firstElementMark = mark();
    11
    startFileBuffering();
    11
    startFileBuffering();
                              
    12
    add(">");
    12
    if (currentLineWidth > lineWidth)
                                                                            
    13
    addLine();
                                
    14
    add(getAttributeIndent());
    14
    add(getAttributeIndent());
    Preondition Violations
    Unmatched statement add(getAttributeIndent()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    else
            
    15
    add(" ");
    15
    add(" ");
    Preondition Violations
    Unmatched statement add(" "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                              
                                      
    13
    add(content);
                                
    14
    add("</");
    Preondition Violations
    Unmatched statement add("</"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    add("</");
    16
    add("xsi:nil=\"true\"/>");
    16
    add("xsi:nil=\"true\"/>");
    16
    add(name);
    Differences
    Expression1Expression2Difference
    "xsi:nil=\"true\"/>"nameTYPE_COMPATIBLE_REPLACEMENT
    16
    add(name);
    17
    --depth;
    15
    --depth;
                              
    17
    add(">");
    Preondition Violations
    Unmatched statement add(">"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    add(">");
    18
    if (!isUnformatted && !isMixed)
    18
    if (!isUnformatted && !isMixed)
    19
    addLine();
    19
    addLine();
    20
    lastElementIsStart = false;
    20
    lastElementIsStart = false;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement add(getAttributeIndent()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement add(" "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement add("</"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement add(">"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted