string.getChars(0, length, outputchars, position); position += length; count += length; if (count > flushThreshold) { os.flush(); count = 0; }
string.getChars(0, length, outputchars, position); position += length; count += length; if (count > flushThreshold) { os.flush(); count = 0; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/StringSegment.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/StringSegment.java
Method name: void writeAscii(OutputStream, int) Method name: void write(Writer, int)
Number of AST nodes: 6 Number of AST nodes: 6
1
string.getChars(0, length, outputchars, position);
1
string.getChars(0, length, outputchars, position);
2
        position += length;
2
        position += length;
3
        count += length;
3
        count += length;
4
        if (count > flushThreshold)
4
        if (count > flushThreshold)
5
        {
5
        {
6
          os.flush();
6
          os.flush();
7
          count = 0;
7
          count = 0;
8
        }
8
        }
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.2
Clones locationClones are declared in the same class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    20
    string.getChars(0, length, outputchars, position);
    15
    string.getChars(0, length, outputchars, position);
    21
    position += length;
    16
    position += length;
    22
    count += length;
    17
    count += length;
    23
    if (count > flushThreshold)
    18
    if (count > flushThreshold)
    24
    os.flush();
    24
    os.flush();
    19
    os.flush();
    Differences
    Expression1Expression2Difference
    java.io.OutputStreamjava.io.WriterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.OutputStream of variable os does not match with type java.io.Writer of variable os
    • Make classes java.io.OutputStream and java.io.Writer extend a common superclass
    19
    os.flush();
    25
    count = 0;
    20
    count = 0;
    Precondition Violations (2)
    Row Violation
    1Type java.io.OutputStream of variable os does not match with type java.io.Writer of variable os
    2Clone fragment #1 returns variables position, count , while Clone fragment #2 returns variables position, count