JIDE 3.5.15

com.jidesoft.comparator
Class AlphanumFileComparator

java.lang.Object
  extended by 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.


Field Summary
static ComparatorContext CONTEXT
           
static ComparatorContext CONTEXT_IGNORE_CASE
           
 
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.
 
Method Summary
 int compare(File f1, File f2)
           
 boolean isCaseSensitive()
          Checks if the case is sensitive when comparing.
 void setCaseSensitive(boolean caseSensitive)
          Sets the case sensitive flag.
 
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
 

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(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.

JIDE 3.5.15