public class NoneSelector extends BaseSelectorContainer { /** * Default constructor. */ public NoneSelector() { } /** * @return a string representation of the selector */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { buf.append("{noneselect: "); buf.append(super.toString()); buf.append("}"); } return buf.toString(); } /** * Returns true (the file is selected) only if all other selectors * agree that the file should not be selected. * * @param basedir the base directory the scan is being done from * @param filename is the name of the file to check * @param file is a java.io.File object for the filename that the selector * can use * @return whether the file should be selected or not */ public boolean isSelected(File basedir, String filename, File file) { validate(); Enumeration e = selectorElements(); boolean result; while (e.hasMoreElements()) { result = ((FileSelector) e.nextElement()).isSelected(basedir, filename, file); if (result) { return false; } } return true;
public class OrSelector extends BaseSelectorContainer { /** * Default constructor. */ public OrSelector() { } /** * @return a string representation of the selector */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { buf.append("{orselect: "); buf.append(super.toString()); buf.append("}"); } return buf.toString(); } /** * Returns true (the file is selected) if any of the other selectors * agree that the file should be selected. * * @param basedir the base directory the scan is being done from * @param filename the name of the file to check * @param file a java.io.File object for the filename that the selector * can use * @return whether the file should be selected or not */ public boolean isSelected(File basedir, String filename, File file) { validate(); Enumeration e = selectorElements(); boolean result; // First, check that all elements are correctly configured while (e.hasMoreElements()) { result = ((FileSelector) e.nextElement()).isSelected(basedir, filename, file); if (result) { return true; } } return false;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/NoneSelector.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/OrSelector.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class NoneSelector extends BaseSelectorContainer {
1
public class OrSelector extends BaseSelectorContainer {
2
    /**
2
    /**
3
     * Default constructor.
3
     * Default constructor.
4
     */
4
     */
5
    public NoneSelector() {
5
    public OrSelector() {
6
    }
6
    }
7
    /**
7
    /**
8
     * @return a string representation of the selector
8
     * @return a string representation of the selector
9
     */
9
     */
10
    public String toString() {
10
    public String toString() {
11
        StringBuffer buf = new StringBuffer();
11
        StringBuffer buf = new StringBuffer();
12
        if (hasSelectors()) {
12
        if (hasSelectors()) {
13
            buf.append("{noneselect: ");
13
            buf.append("{orselect: ");
14
            buf.append(super.toString());
14
            buf.append(super.toString());
15
            buf.append("}");
15
            buf.append("}");
16
        }
16
        }
17
        return buf.toString();
17
        return buf.toString();
18
    }
18
    }
19
    /**
19
    /**
20
     * Returns true (the file is selected) only if all other selectors
20
     * Returns true (the file is selected) if any of the other selectors
21
     * agree that the file should not be selected.
21
     * agree that the file should be selected.
22
     *
22
     *
23
     * @param basedir the base directory the scan is being done from
23
     * @param basedir the base directory the scan is being done from
24
     * @param filename is the name of the file to check
24
     * @param filename the name of the file to check
25
     * @param file is a java.io.File object for the filename that the selector
25
     * @param file a java.io.File object for the filename that the selector
26
     * can use
26
     * can use
27
     * @return whether the file should be selected or not
27
     * @return whether the file should be selected or not
28
     */
28
     */
29
    public boolean isSelected(File basedir, String filename, File file) {
29
    public boolean isSelected(File basedir, String filename, File file) {
30
        validate();
30
        validate();
31
        Enumeration e = selectorElements();
31
        Enumeration e = selectorElements();
32
        boolean result;
32
        boolean result;
33
        // First, check that all elements are correctly configured
33
        while (e.hasMoreElements()) {
34
        while (e.hasMoreElements()) {
34
            result = ((FileSelector) e.nextElement()).isSelected(basedir,
35
            result = ((FileSelector) e.nextElement()).isSelected(basedir,
35
                    filename, file);
36
                    filename, file);
36
            if (result) {
37
            if (result) {
37
                return false;
38
                return true;
38
            }
39
            }
39
        }
40
        }
40
        return true;
41
        return false;
41
    
42
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0