code: public static List<LocalityLevel> neededLocalityLevels(ResourceType type) {
      List<LocalityLevel> l = new ArrayList<LocalityLevel>();
      switch (type) {
      case MAP:
        l.add(LocalityLevel.NODE);
        l.add(LocalityLevel.RACK);
        l.add(LocalityLevel.ANY);
        break;
      case REDUCE:
        l.add(LocalityLevel.ANY);
        break;
      case JOBTRACKER:
        l.add(LocalityLevel.ANY);
        break;
      default:
        throw new RuntimeException("Undefined locality behavior for " + type);
      }
      return l;
    }
docs: Returns the required locality levels, in order of preference,
  for the resource type.
  @param type The type of the resource.
  @return The list of locality levels.