/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ @Override public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Compare the paths of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's path * is less than the second, zero if the paths are the * same and a positive value if the first files path * is greater than the second file. * */ @Override public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath()); }
/** * Compare the extensions of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's extension * is less than the second, zero if the extensions are the * same and a positive value if the first files extension * is greater than the second file. * */ @Override public int compare(final File file1, final File file2) { final String suffix1 = FilenameUtils.getExtension(file1.getName()); final String suffix2 = FilenameUtils.getExtension(file2.getName()); return caseSensitivity.checkCompareTo(suffix1, suffix2); }
@Override public int compare(Path o1, Path o2) { return IOCase.SENSITIVE.checkCompareTo(o1.toUri().toString(), o2.toUri().toString()); } };
@Test public void test_checkCompare_case() throws Exception { assertEquals(0, IOCase.SENSITIVE.checkCompareTo("ABC", "ABC")); assertTrue(IOCase.SENSITIVE.checkCompareTo("ABC", "abc") < 0); assertTrue(IOCase.SENSITIVE.checkCompareTo("abc", "ABC") > 0); assertEquals(0, IOCase.INSENSITIVE.checkCompareTo("ABC", "ABC")); assertEquals(0, IOCase.INSENSITIVE.checkCompareTo("ABC", "abc")); assertEquals(0, IOCase.INSENSITIVE.checkCompareTo("abc", "ABC")); assertEquals(0, IOCase.SYSTEM.checkCompareTo("ABC", "ABC")); assertEquals(WINDOWS, IOCase.SYSTEM.checkCompareTo("ABC", "abc") == 0); assertEquals(WINDOWS, IOCase.SYSTEM.checkCompareTo("abc", "ABC") == 0); }
@Test public void test_checkCompare_functionality() throws Exception { assertTrue(IOCase.SENSITIVE.checkCompareTo("ABC", "") > 0); assertTrue(IOCase.SENSITIVE.checkCompareTo("", "ABC") < 0); assertTrue(IOCase.SENSITIVE.checkCompareTo("ABC", "DEF") < 0); assertTrue(IOCase.SENSITIVE.checkCompareTo("DEF", "ABC") > 0); assertEquals(0, IOCase.SENSITIVE.checkCompareTo("ABC", "ABC")); assertEquals(0, IOCase.SENSITIVE.checkCompareTo("", "")); try { IOCase.SENSITIVE.checkCompareTo("ABC", null); fail(); } catch (final NullPointerException ignore) {} try { IOCase.SENSITIVE.checkCompareTo(null, "ABC"); fail(); } catch (final NullPointerException ignore) {} try { IOCase.SENSITIVE.checkCompareTo(null, null); fail(); } catch (final NullPointerException ignore) {} }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(File file1, File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(File file1, File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Compare the paths of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's path * is less than the second, zero if the paths are the * same and a positive value if the first files path * is greater than the second file. * */ public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath()); }
/** * Compare the paths of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's path * is less than the second, zero if the paths are the * same and a positive value if the first files path * is greater than the second file. * */ public int compare(File file1, File file2) { return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath()); }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ @Override public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Compare the paths of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's path * is less than the second, zero if the paths are the * same and a positive value if the first files path * is greater than the second file. * */ @Override public int compare(final File file1, final File file2) { return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath()); }
/** * Compare the paths of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's path * is less than the second, zero if the paths are the * same and a positive value if the first files path * is greater than the second file. * */ public int compare(File file1, File file2) { return caseSensitivity.checkCompareTo(file1.getPath(), file2.getPath()); }
@Override public int compare(Path o1, Path o2) { return IOCase.SENSITIVE.checkCompareTo(o1.toUri().toString(), o2.toUri().toString()); } };
@Override public int compare(Path o1, Path o2) { return IOCase.SENSITIVE.checkCompareTo(o1.toUri().toString(), o2.toUri().toString()); } };
/** * Compare the names of two files with the specified case sensitivity. * * @param obj1 The first file to compare * @param obj2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(Object obj1, Object obj2) { File file1 = (File)obj1; File file2 = (File)obj2; return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); } }
/** * Compare the names of two files with the specified case sensitivity. * * @param obj1 The first file to compare * @param obj2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(Object obj1, Object obj2) { File file1 = (File)obj1; File file2 = (File)obj2; return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); } }
/** * Compare the extensions of two files the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's extension * is less than the second, zero if the extensions are the * same and a positive value if the first files extension * is greater than the second file. * */ public int compare(final File file1, final File file2) { final String suffix1 = FilenameUtils.getExtension(file1.getName()); final String suffix2 = FilenameUtils.getExtension(file2.getName()); return caseSensitivity.checkCompareTo(suffix1, suffix2); }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(LogFile file1, LogFile file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }