code: public static Set<Integer> getNewOrChangedTaskIds(Set<ResourceWorkerSlot> oldWorkers, Set<ResourceWorkerSlot> workers) {
          Set<Integer> rtn = new HashSet<>();
          HashMap<String, ResourceWorkerSlot> workerPortMap = HostPortToWorkerMap(oldWorkers);
          for (ResourceWorkerSlot worker : workers) {
              ResourceWorkerSlot oldWorker = workerPortMap.get(worker.getHostPort());
              if (oldWorker != null) {
                  Set<Integer> oldTasks = oldWorker.getTasks();
                  for (Integer task : worker.getTasks()) {
                      if (!(oldTasks.contains(task)))
                          rtn.add(task);
                  }
              } else {
                  if (worker.getTasks() != null) {
                      rtn.addAll(worker.getTasks());
                  }
              }
          }
          return rtn;
      }
docs: get all task ids which are newly assigned or reassigned