/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> /// <exception cref="ReservedNameException"> /// The parameter name is already exists. /// </exception> public override Parameter ModifyParameter(Parameter parameter, string declaration) { Match match = singleParamterRegex.Match(declaration); int index = InnerList.IndexOf(parameter); if (index < 0) { return(parameter); } if (match.Success) { Group nameGroup = match.Groups["name"]; Group typeGroup = match.Groups["type"]; if (IsReservedName(nameGroup.Value, index)) { throw new ReservedNameException(nameGroup.Value); } Parameter newParameter = new JavaParameter(nameGroup.Value, typeGroup.Value); InnerList[index] = newParameter; return(newParameter); } else { throw new BadSyntaxException(declaration + " - " + Strings.ErrorInvalidParameterDeclaration); } }
/// <exception cref="ReservedNameException"> /// The parameter name is already exists. /// </exception> public override Parameter Add(string name, string type, ParameterModifier modifier, string defaultValue) { if (IsReservedName(name)) { throw new ReservedNameException(name); } Parameter parameter = new JavaParameter(name, type); InnerList.Add(parameter); return(parameter); }
/// <exception cref="BadSyntaxException"> /// The <paramref name="declaration"/> does not fit to the syntax. /// </exception> /// <exception cref="ReservedNameException"> /// The parameter name is already exists. /// </exception> public override Parameter Add(string declaration) { Match match = singleParamterRegex.Match(declaration); if (match.Success) { Group nameGroup = match.Groups["name"]; Group typeGroup = match.Groups["type"]; if (IsReservedName(nameGroup.Value)) { throw new ReservedNameException(nameGroup.Value); } Parameter parameter = new JavaParameter(nameGroup.Value, typeGroup.Value); InnerList.Add(parameter); return(parameter); } else { throw new BadSyntaxException(declaration + " - " + Strings.ErrorInvalidParameterDeclaration); } }