org.sadun.util.polling
Class DirectoryPoller.ModificationTimeComparator

java.lang.Object
  extended byorg.sadun.util.BidirectionalComparator
      extended byorg.sadun.util.polling.DirectoryPoller.ModificationTimeComparator
All Implemented Interfaces:
java.util.Comparator
Direct Known Subclasses:
FIFOFileComparator, LIFOFileComparator
Enclosing class:
DirectoryPoller

public static class DirectoryPoller.ModificationTimeComparator
extends org.sadun.util.BidirectionalComparator

This comparator can be used to list files based on modification time.

Author:
Cristiano Sadun

Field Summary
 
Fields inherited from class org.sadun.util.BidirectionalComparator
ascending
 
Constructor Summary
DirectoryPoller.ModificationTimeComparator(boolean ascending)
          Create a comparator which will impose an ascending or descending order on modification times depending on the value of the parameter
 
Method Summary
protected  long getComparisonValue(java.io.File f1, java.io.File f2)
          Must return the comparation value (0, greater than 0 or lower than 0) for the two files.
 
Methods inherited from class org.sadun.util.BidirectionalComparator
compare, computeResultFromValue
 
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
 

Constructor Detail

DirectoryPoller.ModificationTimeComparator

public DirectoryPoller.ModificationTimeComparator(boolean ascending)
Create a comparator which will impose an ascending or descending order on modification times depending on the value of the parameter

Parameters:
ascending - if true, older files will be ordered before newer files.
Method Detail

getComparisonValue

protected final long getComparisonValue(java.io.File f1,
                                        java.io.File f2)
Description copied from class: org.sadun.util.BidirectionalComparator
Must return the comparation value (0, greater than 0 or lower than 0) for the two files.

Returns:
the comparation value (0, greater than 0 or lower than 0) for the two files.


Copyright © 1999, 2000 Cristiano Sadun. This software is released under GPL.