Inheritance: NClass.Core.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(
                          Strings.ErrorInvalidParameterDeclaration);
            }
        }
        /// <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)
        {
            var match = singleParamterRegex.Match(declaration);
            var index = InnerList.IndexOf(parameter);

            if (index < 0)
            {
                return(parameter);
            }

            if (match.Success)
            {
                var nameGroup = match.Groups["name"];
                var 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);
            }
            throw new BadSyntaxException(
                      Strings.ErrorInvalidParameterDeclaration);
        }
Exemple #3
0
        /// <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(
                          Strings.GetString("error_invalid_parameter_declaration"));
            }
        }
        /// <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);
        }
Exemple #5
0
        /// <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)
        {
            var param = JavaParameterDeclaration.Create(declaration);

            if (IsReservedName(param.Name))
            {
                throw new ReservedNameException(param.Name);
            }

            var parameter = new JavaParameter(param.Name, param.Type);

            InnerList.Add(parameter);

            return(parameter);
        }
Exemple #6
0
        /// <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)
        {
            var param = JavaParameterDeclaration.Create(declaration);
            int index = InnerList.IndexOf(parameter);

            if (index < 0)
            {
                return(parameter);
            }

            if (IsReservedName(param.Name, index))
            {
                throw new ReservedNameException(param.Name);
            }

            var newParameter = new JavaParameter(param.Name, param.Type);

            InnerList[index] = newParameter;
            return(newParameter);
        }
Exemple #7
0
		/// <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(
					Strings.ErrorInvalidParameterDeclaration);
			}
		}
Exemple #8
0
		/// <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(
					Strings.ErrorInvalidParameterDeclaration);
			}
		}