org.norther.tammi.acorn.io
Class PathNameComparator
java.lang.Object
org.norther.tammi.acorn.io.FileNameComparator
org.norther.tammi.acorn.io.PathNameComparator
- All Implemented Interfaces:
- Serializable, Comparator
public class PathNameComparator
- extends FileNameComparator
A comparator for path names. The paths are considered equal if the shorter
one is included in the longer one. Otherwise the path name is ignored in
sorting.
- Author:
- Ilkka Priha
- See Also:
- Serialized Form
|
Method Summary |
protected int |
compare(File file1,
File file2)
Compares two file names in ascending order. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PathNameComparator
public PathNameComparator()
- Constructs a new comparator.
PathNameComparator
public PathNameComparator(boolean desc)
- Constructs a new comparator with order.
- Parameters:
desc - true for descending order.
compare
protected int compare(File file1,
File file2)
- Compares two file names in ascending order.
- Overrides:
compare in class FileNameComparator
- Parameters:
file1 - the first file to be compared.file2 - the second file to be compared.
- Returns:
- -1, 0 or 1 based on comparison.
- Throws:
NullPointerException - for null files.
Copyright © 2004 The Norther Organization. All rights reserved.