com.jidesoft.comparator
Class AlphanumFileComparator
java.lang.Object
com.jidesoft.comparator.AlphanumFileComparator
- All Implemented Interfaces:
- Comparator<File>
public class AlphanumFileComparator
- extends Object
- implements Comparator<File>
A File comparator to compare the file name based on alphanum value. This class is copied from
AlphanumComparator
except changing it to use File instead of CharSequence.
Constructor Summary |
AlphanumFileComparator()
Creates a case sensitive comparator to use the alphanum algorithm to compare the strings. |
AlphanumFileComparator(boolean caseSensitive)
Creates a comparator to use the alphanum algorithm to compare the strings. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONTEXT
public static final ComparatorContext CONTEXT
CONTEXT_IGNORE_CASE
public static final ComparatorContext CONTEXT_IGNORE_CASE
AlphanumFileComparator
public AlphanumFileComparator()
- Creates a case sensitive comparator to use the alphanum algorithm to compare the strings.
AlphanumFileComparator
public AlphanumFileComparator(boolean caseSensitive)
- Creates a comparator to use the alphanum algorithm to compare the strings.
- Parameters:
caseSensitive
- true or false.
compare
public int compare(File f1,
File f2)
- Specified by:
compare
in interface Comparator<File>
isCaseSensitive
public boolean isCaseSensitive()
- Checks if the case is sensitive when comparing.
- Returns:
- true if the comparator is case sensitive.
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
- Sets the case sensitive flag. By default, it's true meaning the comparator is case sensitive.
- Parameters:
caseSensitive
- true or false.