|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.lucidviews.util.io.AbstractFileComparator
net.lucidviews.util.io.FileDateComparator
public class FileDateComparator
A FileComparator
that compares files using their last-modified
timestamp.
By default this comparator places files in chronological order. I.e: more
recent files would be pushed to the end of a list and older files would
rise to the top.
This logic can be switched by constructing an instance with a
DateComparator
that sorts dates in a reverse chronological
order.
Comparator
,
FileComparator
,
DateComparator
Field Summary | |
---|---|
protected DateComparator |
_dateComparator
The comparator used to compare file timestamps. |
static FileDateComparator |
CHRONOLOGICAL
A FileDateComparator that puts files into chronological
order, based on their (last-modified) timestamp. |
static FileDateComparator |
REVERSE_CHRONOLOGICAL
A FileDateComparator that puts files into reverse
chronological order, based on their (last-modified) timestamp. |
Constructor Summary | |
---|---|
protected |
FileDateComparator()
The default constructor. |
protected |
FileDateComparator(DateComparator dateComparator)
Create a comparator that will order files according to their (last modified) timestamp. |
Method Summary | |
---|---|
int |
compare(File file1,
File file2)
Compares two File s for order. |
boolean |
equals(Object obj)
|
Methods inherited from class net.lucidviews.util.io.AbstractFileComparator |
---|
compare |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final FileDateComparator CHRONOLOGICAL
FileDateComparator
that puts files into chronological
order, based on their (last-modified) timestamp.
public static final FileDateComparator REVERSE_CHRONOLOGICAL
FileDateComparator
that puts files into reverse
chronological order, based on their (last-modified) timestamp.
protected DateComparator _dateComparator
Constructor Detail |
---|
protected FileDateComparator()
protected FileDateComparator(DateComparator dateComparator)
dateComparator
- the comparator to use to compare file timestampsMethod Detail |
---|
public int compare(File file1, File file2)
FileComparator
File
s for order. Returns a negative integer,
zero, or a positive integer as the first file is less than, equal
to, or greater than the second.
file1
- the first file to be comparedfile2
- the second file to be compared
public boolean equals(Object obj)
equals
in interface Comparator
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |