DLESE Tools
v1.6.0

org.dlese.dpc.util
Class FileModDateComparator

java.lang.Object
  extended by org.dlese.dpc.util.FileModDateComparator
All Implemented Interfaces:
Comparator

public class FileModDateComparator
extends Object
implements Comparator

Compares two Files based on their modification date.

Version:
$Id: FileModDateComparator.java,v 1.2 2009/03/20 23:34:00 jweather Exp $
Author:
John Weatherley

Field Summary
static int NEWEST_FIRST
          Sort by newest first.
static int OLDEST_FIRST
          Sort by oldest first.
 
Constructor Summary
FileModDateComparator()
          Default constructor that sorts by newest first.
FileModDateComparator(int sortOrder)
          Constructor that allows setting the sort order by newest or oldest first.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares two Files for sorting by their modification date.
 
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

NEWEST_FIRST

public static final int NEWEST_FIRST
Sort by newest first.

See Also:
Constant Field Values

OLDEST_FIRST

public static final int OLDEST_FIRST
Sort by oldest first.

See Also:
Constant Field Values
Constructor Detail

FileModDateComparator

public FileModDateComparator(int sortOrder)
Constructor that allows setting the sort order by newest or oldest first.

Parameters:
sortOrder - The order for sorting (NEWEST_FIRST or OLDEST_FIRST)
See Also:
NEWEST_FIRST, OLDEST_FIRST

FileModDateComparator

public FileModDateComparator()
Default constructor that sorts by newest first.

Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares two Files for sorting by their modification date.

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.

Specified by:
compare in interface Comparator
Parameters:
o1 - The first Object.
o2 - The second Object.
Returns:
An int indicating sort order.

DLESE Tools
v1.6.0