本文整理汇总了Java中org.apache.commons.io.comparator.NameFileComparator.NAME_INSENSITIVE_COMPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java NameFileComparator.NAME_INSENSITIVE_COMPARATOR属性的具体用法?Java NameFileComparator.NAME_INSENSITIVE_COMPARATOR怎么用?Java NameFileComparator.NAME_INSENSITIVE_COMPARATOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.io.comparator.NameFileComparator
的用法示例。
在下文中一共展示了NameFileComparator.NAME_INSENSITIVE_COMPARATOR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileAlterationObserver
/**
* Construct an observer for the specified directory, file filter and
* file comparator.
*
* @param rootEntry the root directory to observe
* @param fileFilter The file filter or null if none
* @param caseSensitivity what case sensitivity to use comparing file names, null means system sensitive
*/
protected FileAlterationObserver(FileEntry rootEntry, FileFilter fileFilter, IOCase caseSensitivity) {
if (rootEntry == null) {
throw new IllegalArgumentException("Root entry is missing");
}
if (rootEntry.getFile() == null) {
throw new IllegalArgumentException("Root directory is missing");
}
this.rootEntry = rootEntry;
this.fileFilter = fileFilter;
if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
} else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
} else {
this.comparator = NameFileComparator.NAME_COMPARATOR;
}
}
示例2: FileAlterationObserver
/**
* Construct an observer for the specified directory, file filter and
* file comparator.
*
* @param rootEntry the root directory to observe
* @param fileFilter The file filter or null if none
* @param caseSensitivity what case sensitivity to use comparing file names, null means system sensitive
*/
protected FileAlterationObserver(final FileEntry rootEntry, final FileFilter fileFilter,
final IOCase caseSensitivity) {
if (rootEntry == null) {
throw new IllegalArgumentException("Root entry is missing");
}
if (rootEntry.getFile() == null) {
throw new IllegalArgumentException("Root directory is missing");
}
this.rootEntry = rootEntry;
this.fileFilter = fileFilter;
if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
} else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
} else {
this.comparator = NameFileComparator.NAME_COMPARATOR;
}
}
示例3: FileAlterationObserver
/**
* Construct an observer for the specified directory, file filter and
* file comparator.
*
* @param rootEntry the root directory to observe
* @param fileFilter The file filter or null if none
* @param caseSensitivity what case sensitivity to use comparing file names, null means system sensitive
*/
protected FileAlterationObserver(FileEntry rootEntry, FileFilter fileFilter, IOCase caseSensitivity, boolean circulate) {
if (rootEntry == null) {
throw new IllegalArgumentException("Root entry is missing");
}
if (rootEntry.getFile() == null) {
throw new IllegalArgumentException("Root directory is missing");
}
this.rootEntry = rootEntry;
this.fileFilter = fileFilter;
this.circulate = circulate;
if (caseSensitivity == null || caseSensitivity.equals(IOCase.SYSTEM)) {
this.comparator = NameFileComparator.NAME_SYSTEM_COMPARATOR;
} else if (caseSensitivity.equals(IOCase.INSENSITIVE)) {
this.comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
} else {
this.comparator = NameFileComparator.NAME_COMPARATOR;
}
}
示例4: convertSortOrder
protected Comparator<File> convertSortOrder()
{
Comparator<File> result = NameFileComparator.NAME_COMPARATOR;
if ( getSortOrder().equalsIgnoreCase( "NAME_INSENSITIVE_COMPARATOR" ) )
{
result = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_INSENSITIVE_REVERSE" ) )
{
result = NameFileComparator.NAME_INSENSITIVE_REVERSE;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_REVERSE" ) )
{
result = NameFileComparator.NAME_REVERSE;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_SYSTEM_COMPARATOR" ) )
{
result = NameFileComparator.NAME_SYSTEM_COMPARATOR;
}
else if ( getSortOrder().equalsIgnoreCase( "NAME_SYSTEM_REVERSE" ) )
{
result = NameFileComparator.NAME_SYSTEM_REVERSE;
}
return result;
}
示例5: getFilesItemsInCurrentDirectory
public ArrayList<FileItem> getFilesItemsInCurrentDirectory() {
Operations op = Operations.getInstance(mContext);
Constants.SORT_OPTIONS option = op.getmCurrentSortOption();
Constants.FILTER_OPTIONS filterOption = op.getmCurrentFilterOption();
if (mFileNavigator.getmCurrentNode() == null) mFileNavigator.setmCurrentNode(mFileNavigator.getmRootNode());
File[] files = mFileNavigator.getFilesInCurrentDirectory();
if (files != null) {
mFiles.clear();
Comparator<File> comparator = NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
switch(option) {
case SIZE:
comparator = SizeFileComparator.SIZE_COMPARATOR;
break;
case LAST_MODIFIED:
comparator = LastModifiedFileComparator.LASTMODIFIED_COMPARATOR;
break;
}
Arrays.sort(files,comparator);
for (int i = 0; i < files.length; i++) {
boolean addToFilter = true;
switch(filterOption) {
case FILES:
addToFilter = !files[i].isDirectory();
break;
case FOLDER:
addToFilter = files[i].isDirectory();
break;
}
if (addToFilter)
mFiles.add(new FileItem(files[i]));
}
}
return mFiles;
}