code: private boolean canSwap(SubsetSolution solution, Set<Integer> addCandidates, Set<Integer> deleteCandidates){
          return !addCandidates.isEmpty()
                      && !deleteCandidates.isEmpty()
                      && isValidSubsetSize(solution.getNumSelectedIDs());
      }
docs: Check if it is possible to swap a selected and unselected item.
  
  @param solution solution for which moves are generated
  @param addCandidates set of candidate IDs to be added
  @param deleteCandidates set of candidate IDs to be deleted
  @return <code>true</code> if it is possible to perform a swap