@Test public void testCompareFirst() { assertEquals(0, new PermissionsComparator(true).compareFirst(new Path("/a", EnumSet.of(Path.Type.file)), new Path("/b", EnumSet.of(Path.Type.file)))); }
@Override protected int compareFirst(final Path p1, final Path p2) { if(Permission.EMPTY.equals(p1.attributes().getPermission()) && Permission.EMPTY.equals(p2.attributes().getPermission())) { return 0; } if(Permission.EMPTY.equals(p1.attributes().getPermission())) { return -1; } if(Permission.EMPTY.equals(p2.attributes().getPermission())) { return 1; } Integer perm1 = Integer.valueOf(p1.attributes().getPermission().getMode()); Integer perm2 = Integer.valueOf(p2.attributes().getPermission().getMode()); if(perm1 > perm2) { return ascending ? 1 : -1; } else if(perm1 < perm2) { return ascending ? -1 : 1; } return 0; }
PermissionsComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if(Permission.EMPTY.equals(p1.attributes().getPermission()) && Permission.EMPTY.equals(p2.attributes().getPermission())) { return 0; } if(Permission.EMPTY.equals(p1.attributes().getPermission())) { return -1; } if(Permission.EMPTY.equals(p2.attributes().getPermission())) { return 1; } Integer perm1 = Integer.valueOf(p1.attributes().getPermission().getMode()); Integer perm2 = Integer.valueOf(p2.attributes().getPermission().getMode()); if(perm1 > perm2) { return ascending ? 1 : -1; } else if(perm1 < perm2) { return ascending ? -1 : 1; } return 0; } }
PermissionsComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if(Permission.EMPTY.equals(p1.attributes().getPermission()) && Permission.EMPTY.equals(p2.attributes().getPermission())) { return 0; } if(Permission.EMPTY.equals(p1.attributes().getPermission())) { return -1; } if(Permission.EMPTY.equals(p2.attributes().getPermission())) { return 1; } Integer perm1 = Integer.valueOf(p1.attributes().getPermission().getMode()); Integer perm2 = Integer.valueOf(p2.attributes().getPermission().getMode()); if(perm1 > perm2) { return ascending ? 1 : -1; } else if(perm1 < perm2) { return ascending ? -1 : 1; } return 0; } PermissionsComparator(boolean ascending); }
PermissionsComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if(Permission.EMPTY.equals(p1.attributes().getPermission()) && Permission.EMPTY.equals(p2.attributes().getPermission())) { return 0; } if(Permission.EMPTY.equals(p1.attributes().getPermission())) { return -1; } if(Permission.EMPTY.equals(p2.attributes().getPermission())) { return 1; } Integer perm1 = Integer.valueOf(p1.attributes().getPermission().getMode()); Integer perm2 = Integer.valueOf(p2.attributes().getPermission().getMode()); if(perm1 > perm2) { return ascending ? 1 : -1; } else if(perm1 < perm2) { return ascending ? -1 : 1; } return 0; } PermissionsComparator(boolean ascending);  }
PermissionsComparator extends BrowserComparator { @Override protected int compareFirst(final Path p1, final Path p2) { if(Permission.EMPTY.equals(p1.attributes().getPermission()) && Permission.EMPTY.equals(p2.attributes().getPermission())) { return 0; } if(Permission.EMPTY.equals(p1.attributes().getPermission())) { return -1; } if(Permission.EMPTY.equals(p2.attributes().getPermission())) { return 1; } Integer perm1 = Integer.valueOf(p1.attributes().getPermission().getMode()); Integer perm2 = Integer.valueOf(p2.attributes().getPermission().getMode()); if(perm1 > perm2) { return ascending ? 1 : -1; } else if(perm1 < perm2) { return ascending ? -1 : 1; } return 0; } PermissionsComparator(boolean ascending);   }