int i; int ok = 0; while (len-- > 0) { i = read(); if (i == -1) return (ok == 0) ? -1 : ok; b[off++] = (byte) i; ok++; } return ok;
int i; int ok = 0; while (len-- > 0) { i = read(); if (i == -1) return (ok == 0) ? -1 : ok; b[off++] = (char) i; ok++; } return ok;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/gnu/regexp/REFilterInputStream.java File path: /jEdit-4.2/src/gnu/regexp/REFilterReader.java
Method name: int read(byte[], int, int) Method name: int read(char[], int, int)
Number of AST nodes: 9 Number of AST nodes: 9
1
int i;
1
int i;
2
    int ok = 0;
2
    int ok = 0;
3
    while (len-- > 0) {
3
    while (len-- > 0) {
4
      i = read();
4
      i = read();
5
      if (i == -1) return (ok == 0) ? -1 : ok;
5
      if (i == -1) return (ok == 0) ? -1 : ok;
6
      b[off++] = (byte) i;
6
      b[off++] = (char) i;
7
      ok++;
7
      ok++;
8
    }
8
    }
9
    return ok;
9
    return ok;
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 in different classes
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int i;
    1
    int i;
    2
    int ok = 0;
    2
    int ok = 0;
    3
    while (len-- > 0)
    3
    while (len-- > 0)
    4
    i = read();
    4
    i = read();
    5
    if (i == -1)
    5
    if (i == -1)
    6
    return (ok == 0) ? -1 : ok;
    6
    return (ok == 0) ? -1 : ok;
                                            
    7
    b[off++] = (char)i;
    Preondition Violations
    Unmatched statement b[off++]=(char)i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    b[off++] = (char)i;
    7
    b[off++] = (byte)i;
    7
    b[off++] = (byte)i;
    Preondition Violations
    Unmatched statement b[off++]=(byte)i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
    8
    ok++;
    8
    ok++;
    9
    return ok;
    9
    return ok;
    Precondition Violations (2)
    Row Violation
    1Unmatched statement b[off++]=(char)i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement b[off++]=(byte)i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted