@Test public void testCompareFirst() { assertEquals(0, new FileTypeComparator(true).compareFirst(new Path("/a", EnumSet.of(Path.Type.file)), new Path("/a", EnumSet.of(Path.Type.file)))); assertEquals(0, new FileTypeComparator(true).compareFirst(new Path("/a", EnumSet.of(Path.Type.directory)), new Path("/b", EnumSet.of(Path.Type.directory)))); assertEquals(1, new FileTypeComparator(true).compareFirst(new Path("/a", EnumSet.of(Path.Type.file)), new Path("/b", EnumSet.of(Path.Type.directory)))); assertEquals(-1, new FileTypeComparator(true).compareFirst(new Path("/a", EnumSet.of(Path.Type.directory)), new Path("/b", EnumSet.of(Path.Type.file)))); }
@Override protected int compareFirst(final Path p1, final Path p2) { if((p1.isDirectory() && p2.isDirectory()) || p1.isFile() && p2.isFile()) { if(ascending) { return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } if(p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; }
FileTypeComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if((p1.isDirectory() && p2.isDirectory()) || p1.isFile() && p2.isFile()) { if(ascending) { return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } if(p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; } }
FileTypeComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if((p1.isDirectory() && p2.isDirectory()) || p1.isFile() && p2.isFile()) { if(ascending) { return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } if(p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; } FileTypeComparator(boolean ascending); }
FileTypeComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if((p1.isDirectory() && p2.isDirectory()) || p1.isFile() && p2.isFile()) { if(ascending) { return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } if(p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; } FileTypeComparator(boolean ascending);  }
FileTypeComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if((p1.isDirectory() && p2.isDirectory()) || p1.isFile() && p2.isFile()) { if(ascending) { return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2)); } if(p1.isFile()) { return ascending ? 1 : -1; } return ascending ? -1 : 1; } FileTypeComparator(boolean ascending);   }