KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > FileCompare


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11 import java.io.File JavaDoc;
12
13 /**
14  * Class to compare two Files on their modification time, used by SortedVector.
15  * @see SortedVector
16  * @see CompareInterface
17  *
18  * @author David V van Zeventer
19  * @application SCAN or Devices
20  * @version $Id: FileCompare.java,v 1.8 2004/09/30 08:52:11 pierre Exp $
21  * @todo Should be named FileLastModifiedComparator and implement java.util.Comparator
22  */

23 public class FileCompare implements CompareInterface {
24
25     /**
26      * Make the comparison.
27      * The result is a negative value if the time of the first file is 'smaller' than the second,
28      * a positive value if it is 'larger', and 0 if both times are 'equal'.
29      * @param thisOne the first object to compare. should be a <code>File</code>.
30      * @param other the second object to compare. should be a <code>File</code>.
31      * @return the result of the comparison
32      */

33     public int compare(Object JavaDoc thisone,Object JavaDoc other) {
34         return (int) (((File JavaDoc)thisone).lastModified()-((File JavaDoc)other).lastModified());
35     }
36 }
37
Popular Tags