Pelsser.SquaredGaussianModel.Parse C# (CSharp) Method

Parse() public method

Ensure the parameters are correct.
public Parse ( IProject p_Context ) : bool
p_Context IProject /// The underlying project. ///
return bool
        public bool Parse(IProject p_Context)
        {
            bool errors = false;
            BoolHelper.AddBool(errors, this.a1.Parse(p_Context));
            BoolHelper.AddBool(errors, this.sigma1.Parse(p_Context));

            if (this.zr.Expression.IndexOf("@") == -1)
            {
                p_Context.AddError(this.zr.Expression + " is not a reference to a zero rate curve");
            }

            object zrReference = Engine.Parser.EvaluateAsReference(this.zr.Expression);
            if (!Engine.Parser.GetParserError())
            {
                this.zeroRateCurve = zrReference as Function;
                if (this.zeroRateCurve == null)
                {
                    errors = true;

                    p_Context.AddError("Cannot find the Zero Rate Curve! " + this.zr.Expression);
                }

            }
            else
                errors = true;

            if (!errors)
            {
                this.alpha1Temp = this.a1.fV();
                this.sigma1Temp = this.sigma1.fV();
                this.sigma1SquaredTemp = Math.Pow(this.sigma1Temp, 2);
                CalculateGamma();
            }

            return errors;
        }