Top Description Fields Constructors Methods
org.apache.tools.ant.types.resources.comparators

public Class FileSystem

extends ResourceComparator
Class Inheritance
Imports
java.io.File, java.util.Comparator, .Objects, java.util.function.Function, org.apache.tools.ant.types.Resource, org.apache.tools.ant.types.resources.FileProvider, org.apache.tools.ant.util.FileUtils

Compares filesystem Resources.
Since
Ant 1.7

Field Summary

Modifier and TypeField and Description
private static final FileUtils

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private int
compare(File
the first object to be compared.
f1
,
File
the second object to be compared.
f2
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.
private File
protected int

Returns:

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
resourceCompare
(Resource
the first Resource.
foo
,
Resource
the second Resource.
bar
)

Implements abstract org.apache.tools.ant.types.resources.comparators.ResourceComparator.resourceCompare.

Compare two Resources.
Inherited from org.apache.tools.ant.types.resources.comparators.ResourceComparator:
compareequalshashCode

Field Detail

FILE_UTILSback to summary
private static final FileUtils FILE_UTILS

Constructor Detail

FileSystemback to summary
public FileSystem()

Method Detail

compareback to summary
private int compare(File f1, File f2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
f1:File

the first object to be compared.

f2:File

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

fileback to summary
private File file(Resource r)
resourceCompareback to summary
protected int resourceCompare(Resource foo, Resource bar)

Implements abstract org.apache.tools.ant.types.resources.comparators.ResourceComparator.resourceCompare.

Compare two Resources.

Parameters
foo:Resource

the first Resource.

bar:Resource

the second Resource.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Exceptions
ClassCastException:
if either resource is not capable of exposing a FileProvider