private char[] applyErrors(char[] pattern, int upToIndex) {
      if (myBase != null) {
        pattern = myBase.applyErrors(pattern, Math.min(myDeriveIndex, upToIndex));
      }

      if (myErrors != null) {
        for (ErrorWithIndex error : myErrors) {
          if (error.index < upToIndex) {
            pattern = applyError(pattern, error);
          }
        }
      }

      return pattern;
    }
private char[] applyErrors(char[] pattern, int upToIndex)