Exemplo n.º 1
0
 private void DeleteHandler(TransitionRes <StructAtom <string>, StructAtom <string> > transitionRes, GridEditorButton button)
 {
     if (transitionRes.RemoveFromTransition())
     {
         UpdateGrid();
     }
 }
Exemplo n.º 2
0
        private void EllHandler(TransitionRes <StructAtom <string>, StructAtom <string> > transitionRes, GridEditorButton button)
        {
            frmTransitionEdit frm = new frmTransitionEdit();

            frm.DataChanged += frm_DataChanged;
            frm.Show(transitionRes.Transition);
        }
        public void ParseFromNode(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            if (FSM == null)
            {
                throw new NullReferenceException("FSM");
            }

            value = new TransitionRes <StructAtom <string>, StructAtom <string> >();

            try
            {
                for (int i = 0; i < node.ChildNodes.Count; ++i)
                {
                    var childNode = node.ChildNodes[i];
                    switch (childNode.Name.ToLower())
                    {
                    case "deststate":
                    {
                        StateXmlWorker w = new StateXmlWorker();
                        w.FSM = this.FSM;
                        w.ParseFromNode(node.ChildNodes[i]);
                        var state = w.Value as FSMState <StructAtom <string>, StructAtom <string> >;
                        if (state != null)
                        {
                            var exState = FSM.StateSet.First(s => s.KeyName == state.KeyName);
                            if (exState != null)
                            {
                                state = exState;
                            }
                            value.DestState = state;
                        }
                    }
                    break;

                    case "output":
                    {
                        value.Output = new StructAtom <string>(childNode.InnerText);
                    }
                    break;

                    case "probability":
                    {
                        value.Probability = double.Parse(childNode.InnerText);
                    }
                    break;
                    }
                }
            }
            catch (Exception exc)
            {
                value = null;
                throw exc;
            }
        }
 public TransitionResXmlWorker(TransitionRes <StructAtom <string>, StructAtom <string> > transitionRes)
 {
     value = transitionRes;
 }