示例#1
0
 public void AddCompChild(EvalDiagram child)
 {
     this._compChildren.Add(child);
 }
示例#2
0
 public void RemoveCompChild(EvalDiagram child)
 {
     this._compChildren.Remove(child);
 }
示例#3
0
        public override bool LoadObjLinks(object obj, bool wrapped, EmraldModel lists)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.LogicNode == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).LogicNode;
            }


            //load the root obj info
            if (dynObj.rootName != null)
            {
                _rootParent = lists.allLogicNodes.FindByName((string)dynObj.rootName);
                if (_rootParent == null)
                {
                    throw new Exception("Root node " + (string)dynObj.rootName + " not found.");
                }
            }

            //load the gate children
            if (dynObj.gateChildren != null)
            {
                _subGates.Clear();
                foreach (var gateName in dynObj.gateChildren)
                {
                    LogicNode curChildGate = lists.allLogicNodes.FindByName((string)gateName);
                    if (curChildGate == null)
                    {
                        throw new Exception("Deserialize Logic failed to find child gate - " + gateName);
                    }

                    if (!_subGates.Contains(curChildGate))
                    {
                        _subGates.Add(curChildGate);
                    }
                }
            }

            //load the component children
            if (dynObj.compChildren != null)
            {
                _compChildren.Clear();
                foreach (var stateName in dynObj.compChildren)
                {
                    EvalDiagram curChildComp = (EvalDiagram)lists.allDiagrams.FindByName((string)stateName);
                    if (curChildComp == null)
                    {
                        throw new Exception("Deserialize Logic gate Failed to find child state - " + stateName);
                    }

                    _compChildren.Add(curChildComp);
                }
            }
            return(true);
        }