/** * Compares to work packages after the successors. * * @param ap1 The first work package. * @param ap2 The second work package which has to compare with the first one. * @return a negative integer, zero, or a positive integer as the first argument is less than, * equal to, or greater than the second. */ @Override public final int compare(final Workpackage ap1, final Workpackage ap2) { if (WpManager.getFollowers(ap1) != null && WpManager.getFollowers(ap2) != null) { return WpManager.getFollowers(ap1).size() - WpManager.getFollowers(ap2).size(); } else if (WpManager.getFollowers(ap1) == null && WpManager.getFollowers(ap2) == null) { return 0; } else if (WpManager.getFollowers(ap1) == null) { return 1; } else { return -1; } }