net.sourceforge.java.util.io
Class FileUtils.FileComparator

java.lang.Object
  extended bynet.sourceforge.java.util.io.FileUtils.FileComparator
All Implemented Interfaces:
Comparator
Direct Known Subclasses:
FileUtils.FileDateComparator, FileUtils.FileNameComparator, FileUtils.FileSizeComparator
Enclosing class:
FileUtils

public abstract static class FileUtils.FileComparator
extends Object
implements Comparator

Abstract base Comparator for file attributes.

Author:
Sebastian Machhausen

Field Summary
private  boolean ascending
           The sort order: true = ascending, false = descending
 
Constructor Summary
FileUtils.FileComparator()
           
 
Method Summary
 int compare(File file1, File file2)
           Compares two objects.
 int compare(Object obj1, Object obj2)
           Compares two objects.
 boolean isAscending()
           Gets the sort order.
 void setAscending(boolean ascending)
           Sets the sort order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

ascending

private boolean ascending

The sort order: true = ascending, false = descending

Constructor Detail

FileUtils.FileComparator

public FileUtils.FileComparator()
Method Detail

setAscending

public void setAscending(boolean ascending)

Sets the sort order. true for ascending, false for descending. Default is ascending.

Parameters:
ascending - true for ascending, false for descending sort order
See Also:
isAscending()

isAscending

public boolean isAscending()

Gets the sort order. true if ascending, false if descending.

Returns:
true if ascending, false if descending sort order
See Also:
setAscending(boolean)

compare

public int compare(File file1,
                   File file2)

Compares two objects.

Parameters:
file1 - the first File object to compare
file2 - the second File object to compare
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

compare

public int compare(Object obj1,
                   Object obj2)

Compares two objects.

Specified by:
compare in interface Comparator
Parameters:
obj1 - the first File object to compare
obj2 - the second File object to compare
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.