Package adams.core.io
Class FileObjectComparator
- java.lang.Object
-
- adams.core.io.FileObjectComparator
-
- All Implemented Interfaces:
Serializable
,Comparator<FileObject>
public class FileObjectComparator extends Object implements Serializable, Comparator<FileObject>
Comparator forFileObject
objects.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_CaseSensitive
whether to perform case-sensitive comparisons.protected boolean
m_IncludeParentDirs
whether to include parent directories in sorting.protected boolean
m_ListDirsFirst
whether to list directoris first.
-
Constructor Summary
Constructors Constructor Description FileObjectComparator(boolean caseSensitive, boolean listDirsFirst, boolean includeParentDirs)
Initializes the comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(FileObject o1, FileObject o2)
Compares the two file wrappers.boolean
isCaseSensitive()
Returns whether comparison is case-sensitive.boolean
isIncludeParentDirs()
Returns whether to include parent directories in the comparison.boolean
isListDirsFirst()
Returns whether to list directories first.-
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
m_CaseSensitive
protected boolean m_CaseSensitive
whether to perform case-sensitive comparisons.
-
m_ListDirsFirst
protected boolean m_ListDirsFirst
whether to list directoris first.
-
m_IncludeParentDirs
protected boolean m_IncludeParentDirs
whether to include parent directories in sorting.
-
-
Constructor Detail
-
FileObjectComparator
public FileObjectComparator(boolean caseSensitive, boolean listDirsFirst, boolean includeParentDirs)
Initializes the comparator.- Parameters:
caseSensitive
- true if to perform case-sensitive comparisonslistDirsFirst
- whether to list directories first or to mix them in with filesincludeParentDirs
- whether to include parent directories in the comparison
-
-
Method Detail
-
isCaseSensitive
public boolean isCaseSensitive()
Returns whether comparison is case-sensitive.- Returns:
- true if case-sensitive
-
isListDirsFirst
public boolean isListDirsFirst()
Returns whether to list directories first.- Returns:
- true if to list dirs first
-
isIncludeParentDirs
public boolean isIncludeParentDirs()
Returns whether to include parent directories in the comparison.- Returns:
- true if included
-
compare
public int compare(FileObject o1, FileObject o2)
Compares the two file wrappers.- Specified by:
compare
in interfaceComparator<FileObject>
- Parameters:
o1
- the first wrappero2
- the second wrapper- Returns:
- less than, equal to or greater than zero if the first wrapper is less than, equal to or greater than the second one.
-
-