package org.apache.tools.ant.types.resources.comparators; import org.apache.tools.ant.types.Resource; /** * Compares Resources by existence. Not existing is "less than" existing. * @since Ant 1.7 */ public class Exists extends ResourceComparator { /** * Compare two Resources. * @param foo the first Resource. * @param bar the second Resource. * @return a negative integer, zero, or a positive integer as the first * argument is less than, equal to, or greater than the second. */ protected int resourceCompare(Resource foo, Resource bar) { boolean f = foo.isExists(); if (f == bar.isExists()) { return 0; } return f ? 1 : -1; }
package org.apache.tools.ant.types.resources.comparators; import org.apache.tools.ant.types.Resource; /** * Compares Resources by is-directory status. As a container * of files, a directory is deemed "greater" than a file. * @since Ant 1.7 */ public class Type extends ResourceComparator { /** * Compare two Resources. * @param foo the first Resource. * @param bar the second Resource. * @return a negative integer, zero, or a positive integer as the first * argument is less than, equal to, or greater than the second. */ protected int resourceCompare(Resource foo, Resource bar) { boolean f = foo.isDirectory(); if (f == bar.isDirectory()) { return 0; } return f ? 1 : -1; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/comparators/Exists.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/comparators/Type.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
package org.apache.tools.ant.types.resources.comparators;
1
package org.apache.tools.ant.types.resources.comparators;
2
import org.apache.tools.ant.types.Resource;
2
import org.apache.tools.ant.types.Resource;
3
/**
3
/**
4
 * Compares Resources by existence.  Not existing is "less than" existing
4
 * Compares Resources by is-directory status.  As a container
5
.
5
 * of files, a directory is deemed "greater" than a file.
6
 * @since Ant 1.7
6
 * @since Ant 1.7
7
 */
7
 */
8
public class Exists extends ResourceComparator {
8
public class Type extends ResourceComparator {
9
    /**
9
    /**
10
     * Compare two Resources.
10
     * Compare two Resources.
11
     * @param foo the first Resource.
11
     * @param foo the first Resource.
12
     * @param bar the second Resource.
12
     * @param bar the second Resource.
13
     * @return a negative integer, zero, or a positive integer as the first
13
     * @return a negative integer, zero, or a positive integer as the first
14
     *         argument is less than, equal to, or greater than the second.
14
     *         argument is less than, equal to, or greater than the second.
15
     */
15
     */
16
    protected int resourceCompare(Resource foo, Resource bar) {
16
    protected int resourceCompare(Resource foo, Resource bar) {
17
        boolean f = foo.isExists();
17
        boolean f = foo.isDirectory();
18
        if (f == bar.isExists()) {
18
        if (f == bar.isDirectory()) {
19
            return 0;
19
            return 0;
20
        }
20
        }
21
        return f ? 1 : -1;
21
        return f ? 1 : -1;
22
    }
22
    }
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