예제 #1
0
 protected void CloneFunction(FitterFunction template)
 {
     this.Name        = template.Name;
     this.Description = template.Description;
     this.Parameters.Clear();
     foreach (FitterParameter p in template.Parameters)
     {
         this.Parameters.Add(new FitterParameter(p));
     }
 }
예제 #2
0
 /// <summary>
 /// Adds a function based on the name given
 /// </summary>
 public FitterFunction Add(string name)
 {
     foreach (FitterFunction f in FunctionTemplates)
     {
         if (f.Name != name)
         {
             continue;
         }
         FitterFunction tmp = f.Clone();
         Functions.Add(tmp);
         return(tmp);
     }
     return(null);
 }
예제 #3
0
 /// <summary>
 /// Attempts to parse a file line as a Solution function
 /// </summary>
 /// <param name="s">line to parse</param>
 /// <returns>true if passed the comment block</returns>
 public bool LoadSolutionLine(string s)
 {
     foreach (FitterFunction f in FunctionTemplates)
     {
         string sCheck = "# " + f.Name + "(";
         if (!s.StartsWith(sCheck))
         {
             continue;
         }
         s = s.Substring(sCheck.Length).Replace(" ", "").Replace(")", "");
         FitterFunction newFunction = f.Clone();
         foreach (FitterParameter p in newFunction.Parameters)
         {
             p.FromString(s);
         }
         Functions.Add(newFunction);
         return(true);
     }
     return(false);
 }