/*
     * dirNames is an array of string integers derived from usual directory
     * structure data/subdirN/subdirXY/subdirM ... If dirName array is
     * non-null, we only check the child at the children[dirNames[idx]].
     * This avoids iterating over children in common case. If directory
     * structure changes in later versions, we need to revisit this.
     */
    private boolean clearPath(File f, String[] dirNames, int idx) {
      if ((dirNames == null || idx == dirNames.length) && dir.compareTo(f) == 0) {
        numBlocks--;
        return true;
      }

      if (dirNames != null) {
        // guess the child index from the directory name
        if (idx > (dirNames.length - 1) || children == null) {
          return false;
        }
        int childIdx;
        try {
          childIdx = Integer.parseInt(dirNames[idx]);
        } catch (NumberFormatException ignored) {
          // layout changed? we could print a warning.
          return false;
        }
        return (childIdx >= 0 && childIdx < children.length)
            ? children[childIdx].clearPath(f, dirNames, idx + 1)
            : false;
      }

      // guesses failed. back to blind iteration.
      if (children != null) {
        for (int i = 0; i < children.length; i++) {
          if (children[i].clearPath(f, null, -1)) {
            return true;
          }
        }
      }
      return false;
    }
  public int compareTo(FileWrapper aOther) {
    if (aOther != null) {
      // Who says ternary is hard to follow
      if (isEnabled() == aOther.isEnabled()) {
        return (typeIndex == aOther.typeIndex)
            ? file.compareTo(aOther.file)
            : ((typeIndex < aOther.typeIndex) ? -1 : 1);
      } else {
        return isEnabled() ? -1 : 1;
      }
    }

    return -1;
  }