public void RemoveParam(IScnPrm prm) { if (Prms.Contains(prm)) { Prms.Remove(prm); prm.GetVal = null; prm.SetVal = null; prm.MyDiff = null; } }
public int AddParam(IScnPrm prm) { if (!Prms.Contains(prm)) { if (prm.Owner != null && prm.Owner != this) { prm.Owner.RemoveParam(prm); } Prms.Add(prm); prm.Owner = this; } return(Prms.Count); }
public bool SetDiff(IScnPrm prm, Func <double, double> dPrmdtF, string dname = "") { if (!Prms.Contains(prm)) { return(false); } var dprm = new ScnPrm(); dprm.GetVal = new Func <double, double>(dPrmdtF); bool newname = dname == ""; if (!newname) { dprm.Name = dname; } AddDiffPropToParam(prm, dprm, getNewName: newname); return(true); }
public void AddDiffPropToParam(IScnPrm prm, IScnPrm dPrmDt, bool removeOldDt = true, bool getNewName = false) { if (!Prms.Contains(prm)) { AddParam(prm); } if (removeOldDt && prm.MyDiff != null && Prms.Contains(prm.MyDiff)) { Prms.Remove(prm.MyDiff); } if (getNewName) { dPrmDt.Name = prm.Name + "'"; } prm.MyDiff = dPrmDt; if (dPrmDt.Owner == null) { AddParam(dPrmDt); } }