if (replaceIndex != -1) { final int ch = replaceData.charAt(replaceIndex++); if (replaceIndex >= replaceData.length()) { replaceIndex = -1; } return ch; }
if (queueIndex != -1) { final int ch = queuedData.charAt(queueIndex++); if (queueIndex >= queuedData.length()) { queueIndex = -1; } return ch; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ReplaceTokens.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ReplaceTokens.java
Method name: int read() Method name: int getNextChar()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (replaceIndex != -1) {
1
if (queueIndex != -1) {
2
            final int ch = replaceData.charAt(replaceIndex++);
2
            final int ch = queuedData.charAt(queueIndex++);
3
            if (replaceIndex >= replaceData.length()) {
3
            if (queueIndex >= queuedData.length()) {
4
                replaceIndex = -1;
4
                queueIndex = -1;
5
            }
5
            }
6
            return ch;
6
            return ch;
7
        }
7
        }
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    if (replaceIndex != -1)
    4
    if (replaceIndex != -1)
    1
    if (queueIndex != -1)
    Differences
    Expression1Expression2Difference
    replaceIndexqueueIndexVARIABLE_NAME_MISMATCH
    1
    if (queueIndex != -1)
    5
    final int ch = replaceData.charAt(replaceIndex++);
    5
    final int ch = replaceData.charAt(replaceIndex++);
    2
    final int ch = queuedData.charAt(queueIndex++);
    Differences
    Expression1Expression2Difference
    replaceIndexqueueIndexVARIABLE_NAME_MISMATCH
    replaceDataqueuedDataVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression replaceIndex is a field being modified, and thus it cannot be parameterized
    Expression queueIndex is a field being modified, and thus it cannot be parameterized
    2
    final int ch = queuedData.charAt(queueIndex++);
    6
    if (replaceIndex >= replaceData.length())
    6
    if (replaceIndex >= replaceData.length())
    3
    if (queueIndex >= queuedData.length())
    Differences
    Expression1Expression2Difference
    replaceIndexqueueIndexVARIABLE_NAME_MISMATCH
    replaceDataqueuedDataVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression replaceIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression queueIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (queueIndex >= queuedData.length())
    7
    replaceIndex = -1;
    7
    replaceIndex = -1;
    4
    queueIndex = -1;
    Differences
    Expression1Expression2Difference
    replaceIndexqueueIndexVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression replaceIndex is a field being modified, and thus it cannot be parameterized
    Expression queueIndex is a field being modified, and thus it cannot be parameterized
    4
    queueIndex = -1;
    8
    return ch;
    5
    return ch;
    Precondition Violations (6)
    Row Violation
    1Expression replaceIndex is a field being modified, and thus it cannot be parameterized
    2Expression queueIndex is a field being modified, and thus it cannot be parameterized
    3Expression replaceIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression queueIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression replaceIndex is a field being modified, and thus it cannot be parameterized
    6Expression queueIndex is a field being modified, and thus it cannot be parameterized