Beispiel #1
0
		public virtual void Initialize (IFormulaParent _parent)
		{
			mParent = _parent;
			mFormulaText = mParent.GetFormulaText ();

			Debug.Assert (!string.IsNullOrEmpty (mFormulaText), 
				"Formula is empty for component : " + Error.Hierarchy(mParent.GetComponent()));

			mParameters = new Dictionary<string, Parameter> ();
			MatchCollection matches = ParamRegex.Matches (mFormulaText);


			foreach (Match m in matches) {
				Parameter p = new Parameter (m, _parent);
				mFormulaText = mFormulaText.Replace (p.initialName, p.alias);
				if (!mParameters.ContainsKey(p.alias)) {
					mParameters.Add (p.alias, p);
				}
			}


			mIsInitialized = true;

		}
Beispiel #2
0
 /// <summary>
 /// Copy-Constructor: creates a new instance of the Parameter
 /// class, as a deep copy of the Parameter passed as parameter.
 /// </summary>
 /// <param name="rhs">The Parameter to be copied.</param>
 public Parameter(Parameter rhs)
 {
     name	  = rhs.name;
       type	  = rhs.type;
       val	  = rhs.val;
 }
Beispiel #3
0
        /// <summary>
        /// Adds the specified Parameter to the set held by the Engine.
        /// If another Parameter was defined in the Engine with the same name,
        /// the pre-existing Parameter is overwritten.
        /// <exception cref="System.ApplicationException">Thrown if the Engine
        /// is currently WORKING.</exception>
        /// </summary>
        /// <param name="p"></param>
        public void AddParameter(Parameter p)
        {
            if(status==EngineStatus.WORKING)
            throw new ApplicationException("CFGLite: [Engine::AddParameter(Parameter)]\n"+
              "The Engine is currently Working.");

              //Overwrites any existing parameter with same name !
              parameters[p.Name]=p.Clone();
        }