/// <summary>
        /// Parses the object and checks if all the restraints of the 2D Point Function
        /// have been respected, if not will return an error to the parser.
        /// </summary>
        /// <remarks>
        /// Note that this method caches the object status, so any changes done to its data
        /// will require this method to be called again in order to update the cache.
        /// </remarks>
        /// <param name="context">The project in which to parse the object.</param>
        /// <returns>True if an error occurred during the parsing, False otherwise.</returns>
        public override bool Parse(IProject context)
        {
            try
            {
                this.function = new CPointFunction2D(this.coordinatesX, this.coordinatesY,
                                                     this.values, this.interpolationType,
                                                     this.extrapolationType);
                CreateSymbol(context as Project);
            }
            catch (Exception e)
            {
                string msg = e.Message + " for the 2D Function " + base.Name;
                if (context != null)
                {
                    context.AddError(msg);
                }
                else
                {
                    throw e;
                }

                // Return true as an error was raised during the parsing.
                return(true);
            }

            // Return false as no error have raised during the parsing.
            return(false);
        }
Exemple #2
0
 /// <summary>
 /// Copies the data inside this <see cref="CPointFunction2D"/>
 /// into another <see cref="CPointFunction2D"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="CPointFunction2D"/> where to copy the data to.
 /// </param>
 internal void CopyTo(CPointFunction2D other)
 {
     other.SetSizes(this.coordinatesX.Count, this.coordinatesY.Count);
     this.coordinatesX.CopyTo(other.coordinatesX);
     this.coordinatesY.CopyTo(other.coordinatesY);
     this.values.CopyTo(other.values);
     other.interpolationType = this.interpolationType;
     other.extrapolationType = this.extrapolationType;
 }
 /// <summary>
 /// Copies the data inside this <see cref="CPointFunction2D"/>
 /// into another <see cref="CPointFunction2D"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="CPointFunction2D"/> where to copy the data to.
 /// </param>
 internal void CopyTo(CPointFunction2D other)
 {
     other.SetSizes(this.coordinatesX.Count, this.coordinatesY.Count);
     this.coordinatesX.CopyTo(other.coordinatesX);
     this.coordinatesY.CopyTo(other.coordinatesY);
     this.values.CopyTo(other.values);
     other.interpolationType = this.interpolationType;
     other.extrapolationType = this.extrapolationType;
 }
Exemple #4
0
        /// <summary>
        /// Parses the object and checks if all the restraints of the 2D Point Function
        /// have been respected, if not will return an error to the parser.
        /// </summary>
        /// <remarks>
        /// Note that this method caches the object status, so any changes done to its data
        /// will require this method to be called again in order to update the cache.
        /// </remarks>
        /// <param name="context">The project in which to parse the object.</param>
        /// <returns>True if an error occurred during the parsing, False otherwise.</returns>
        public override bool Parse(IProject context)
        {
            try
            {
                this.function = new CPointFunction2D(this.coordinatesX, this.coordinatesY,
                                                     this.values, this.interpolationType,
                                                     this.extrapolationType);
                CreateSymbol(context as Project);
            }
            catch (Exception e)
            {
                string msg = e.Message + " for the 2D Function " + base.Name;
                if (context != null)
                {
                    context.AddError(msg);
                }
                else
                {
                    throw e;
                }

                // Return true as an error was raised during the parsing.
                return true;
            }

            // Return false as no error have raised during the parsing.
            return false;
        }
Exemple #5
0
        /// <summary>
        /// Parses the object.
        /// </summary>
        /// <param name="context">The project in which to parse the object.</param>
        /// <returns>True if an error occurred during the parsing, False otherwise.</returns>
        public override bool Parse(IProject context)
        {
            try
            {
                function = new CPointFunction2D(cordinatesX, cordinatesY, values,
                                                interpolationType, extrapolationType);
            }
            catch (Exception e)
            {
                context.AddError(e.Message + " for the 2D Function " + base.Name);
                return false;
            }

            return base.Parse(context);
        }