| | |
| | | package de.uhilger.filecms.pub; |
| | | |
| | | import java.io.File; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.logging.Logger; |
| | | |
| | | /** |
| | | * |
| | | * @author ulrich |
| | | */ |
| | | public class FileDateComparator implements Comparator { |
| | | |
| | | private static final Logger logger = Logger.getLogger(FileDateComparator.class.getName()); |
| | | |
| | | private String order; |
| | | public class FileDateComparator extends AbstractComparator { |
| | | |
| | | public FileDateComparator(String order) { |
| | | this.order = order; |
| | |
| | | if(f1 != null && f2 != null) { |
| | | Date l1 = new Date(f1.lastModified()); |
| | | Date l2 = new Date(f2.lastModified()); |
| | | if(order != null && order.equalsIgnoreCase("asc")) { |
| | | if(order != null && order.equalsIgnoreCase(ORDER_ASC)) { |
| | | if(l1.before(l2)) { |
| | | logger.fine("asc: " + f1.getName() + " kleiner " + f2.getName()); |
| | | return -1; |