Package com.jidesoft.comparator
Class AlphanumFileComparator
- java.lang.Object
-
- com.jidesoft.comparator.AlphanumFileComparator
-
- All Implemented Interfaces:
java.util.Comparator<java.io.File>
public class AlphanumFileComparator extends java.lang.Object implements java.util.Comparator<java.io.File>
A File comparator to compare the file name based on alphanum value. This class is copied fromAlphanumComparator
except changing it to use File instead of CharSequence.
-
-
Field Summary
Fields Modifier and Type Field Description static ComparatorContext
CONTEXT
static ComparatorContext
CONTEXT_IGNORE_CASE
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.io.File f1, java.io.File f2)
boolean
isCaseSensitive()
Checks if the case is sensitive when comparing.void
setCaseSensitive(boolean caseSensitive)
Sets the case sensitive flag.
-
-
-
Field Detail
-
CONTEXT
public static final ComparatorContext CONTEXT
-
CONTEXT_IGNORE_CASE
public static final ComparatorContext CONTEXT_IGNORE_CASE
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
compare
public int compare(java.io.File f1, java.io.File f2)
- Specified by:
compare
in interfacejava.util.Comparator<java.io.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.
-
-