if (isReference()) { throw noChildrenAllowed(); } String[] nestedIncludes = p.getIncludePatterns(getProject()); String[] nestedExcludes = p.getExcludePatterns(getProject()); if (nestedIncludes != null) { for (int i = 0; i < nestedIncludes.length; i++) { createInclude().setName(nestedIncludes[i]); } } if (nestedExcludes != null) { for (int i = 0; i < nestedExcludes.length; i++) { createExclude().setName(nestedExcludes[i]); } }
if (isReference()) { throw new BuildException("Cannot append to a reference"); } String[] incl = other.getIncludePatterns(p); if (incl != null) { for (int i = 0; i < incl.length; i++) { createInclude().setName(incl[i]); } } String[] excl = other.getExcludePatterns(p); if (excl != null) { for (int i = 0; i < excl.length; i++) { createExclude().setName(excl[i]); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/PatternSet.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/PatternSet.java
Method name: void addConfiguredPatternset(PatternSet) Method name: void append(PatternSet, Project)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (isReference()) {
1
if (isReference()) {
2
            throw noChildrenAllowed();
2
            throw n
3
        }
4
        String[] nestedIncludes = p.getIncludePatterns(getProject());
5
        String[] nestedExcludes = p
3
ew BuildException("Cannot append to a reference");
4
        }
6
.getExcludePatterns(getProject());
5
        String[] incl = other.getIncludePatterns(p);
7
        if (nestedIncludes != null) {
6
        if (incl != null) {
8
            for (int i = 0; i < nestedIncludes.length; i++) {
7
            for (int i = 0; i < incl.length; i++) {
9
                createInclude().setName(nestedIncludes[i]);
8
                createInclude().setName(incl[i]);
10
            }
9
            }
11
        }
10
        }
12
        if (nestedExcludes
11
        String[] excl = other.getExcludePatterns(p);
13
 != null) {
12
        if (excl != null) {
14
            for (int i = 0; i < nestedExcludes.length; i++) {
13
            for (int i = 0; i < excl.length; i++) {
15
                createExclude().setName(nestedExcludes[i]);
14
                createExclude().setName(excl[i]);
16
            }
15
            }
17
        }
16
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.8
Clones locationClones are declared in the same class
Number of node comparisons27
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (isReference())
    1
    if (isReference())
    2
    throw noChildrenAllowed();
    2
    throw noChildrenAllowed();
    2
    throw new BuildException("Cannot append to a reference");
    Differences
    Expression1Expression2Difference
    noChildrenAllowed()new BuildException("Cannot append to a reference")TYPE_COMPATIBLE_REPLACEMENT
    2
    throw new BuildException("Cannot append to a reference");
    3
    String[] nestedIncludes = p.getIncludePatterns(getProject());
    3
    String[] nestedIncludes = p.getIncludePatterns(getProject());
    3
    String[] incl = other.getIncludePatterns(p);
    Differences
    Expression1Expression2Difference
    nestedIncludesinclVARIABLE_NAME_MISMATCH
    getProject()pTYPE_COMPATIBLE_REPLACEMENT
    potherVARIABLE_NAME_MISMATCH
    3
    String[] incl = other.getIncludePatterns(p);
    4
    String[] nestedExcludes = p.getExcludePatterns(getProject());
    4
    String[] nestedExcludes = p.getExcludePatterns(getProject());
    7
    String[] excl = other.getExcludePatterns(p);
    Differences
    Expression1Expression2Difference
    nestedExcludesexclVARIABLE_NAME_MISMATCH
    getProject()pTYPE_COMPATIBLE_REPLACEMENT
    potherVARIABLE_NAME_MISMATCH
    7
    String[] excl = other.getExcludePatterns(p);
    5
    if (nestedIncludes != null)
    5
    if (nestedIncludes != null)
    4
    if (incl != null)
    Differences
    Expression1Expression2Difference
    nestedIncludesinclVARIABLE_NAME_MISMATCH
    4
    if (incl != null)
    6
    for (int i = 0; i < nestedIncludes.length; i++)
    6
    for (int i = 0; i < nestedIncludes.length; i++)
    5
    for (int i = 0; i < incl.length; i++)
    Differences
    Expression1Expression2Difference
    nestedIncludesinclVARIABLE_NAME_MISMATCH
    5
    for (int i = 0; i < incl.length; i++)
    7
    createInclude().setName(nestedIncludes[i]);
    7
    createInclude().setName(nestedIncludes[i]);
    6
    createInclude().setName(incl[i]);
    Differences
    Expression1Expression2Difference
    nestedIncludesinclVARIABLE_NAME_MISMATCH
    6
    createInclude().setName(incl[i]);
    8
    if (nestedExcludes != null)
    8
    if (nestedExcludes != null)
    8
    if (excl != null)
    Differences
    Expression1Expression2Difference
    nestedExcludesexclVARIABLE_NAME_MISMATCH
    8
    if (excl != null)
    9
    for (int i = 0; i < nestedExcludes.length; i++)
    9
    for (int i = 0; i < nestedExcludes.length; i++)
    9
    for (int i = 0; i < excl.length; i++)
    Differences
    Expression1Expression2Difference
    nestedExcludesexclVARIABLE_NAME_MISMATCH
    9
    for (int i = 0; i < excl.length; i++)
    10
    createExclude().setName(nestedExcludes[i]);
    10
    createExclude().setName(nestedExcludes[i]);
    10
    createExclude().setName(excl[i]);
    Differences
    Expression1Expression2Difference
    nestedExcludesexclVARIABLE_NAME_MISMATCH
    10
    createExclude().setName(excl[i]);
    Precondition Violations (0)
    Row Violation