code: public int getThisTaskIndex() {
      List<Integer> allTasks = getComponentTasks(getThisComponentId());
      int retVal = 0;
      for (Integer tsk : allTasks) {
        if (tsk < myTaskId) {
          retVal++;
        }
      }
      return retVal;
    }
docs: Gets the index of this task id in getComponentTasks(getThisComponentId()).
  An example use case for this method is determining which task
  accesses which resource in a distributed resource to ensure an even distribution.