if (++i < argument.length()) { c = argument.charAt(i); int value = Character.digit(c, 10); if (value > -1) { result.append((String) v.elementAt(value)); } else { result.append(c); } } else { // XXX - should throw an exception instead? result.append('\\'); }
if (++i < argument.length()) { c = argument.charAt(i); int value = Character.digit(c, 10); if (value > -1) { subst.append("$").append(value); } else { subst.append(c); } } else { // XXX - should throw an exception instead? subst.append('\\'); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java
Method name: String substitute(String, String, int) Method name: String substitute(String, String, int)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (++i < argument.length()) {
1
if (++i < argument.length()) {
2
                    c = argument.charAt(i);
2
                    c = argument.charAt(i);
3
                    int value = Character.digit(c, 10);
3
                    int value = Character.digit(c, 10);
4
                    if (value > -1) {
4
                    if (value > -1) {
5
                        result.append((String) v.elementAt(value));
5
                        subst.append("$").append(value);
6
                    } else {
6
                    } else {
7
                        result.append(c);
7
                        subst.append(c);
8
                    }
8
                    }
9
                } else {
9
                } else {
10
                    // XXX - should throw an exception instead?
10
                    // XXX - should throw an exception instead?
11
                    result.append('\\');
11
                    subst.append('\\');
12
                }
12
                }
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.3
Clones locationClones are in different classes
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (++i < argument.length())
    8
    if (++i < argument.length())
    7
    c = argument.charAt(i);
    9
    c = argument.charAt(i);
    8
    int value = Character.digit(c, 10);
    10
    int value = Character.digit(c, 10);
    9
    if (value > -1)
    11
    if (value > -1)
    10
    result.append((String)v.elementAt(value));
    10
    result.append((String)v.elementAt(value));
    Preondition Violations
    Unmatched statement result.append((String)v.elementAt(value)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                                                            
    12
    subst.append("$").append(value);
    Preondition Violations
    Unmatched statement subst.append("$").append(value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    subst.append("$").append(value);
    else
    else
    11
    result.append(c);
    11
    result.append(c);
    13
    subst.append(c);
    Differences
    Expression1Expression2Difference
    resultsubstVARIABLE_NAME_MISMATCH
    13
    subst.append(c);
    else
    else
    12
    result.append('\\');
    12
    result.append('\\');
    14
    subst.append('\\');
    Differences
    Expression1Expression2Difference
    resultsubstVARIABLE_NAME_MISMATCH
    14
    subst.append('\\');
    Precondition Violations (3)
    Row Violation
    1Unmatched statement result.append((String)v.elementAt(value)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement subst.append("$").append(value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables i, value , while Clone fragment #2 returns variables i, value