Esempio n. 1
0
 public bool LoadData(CompuMethod dat)
 {
     currentCM                  = dat;
     this.entryName.Text        = dat.name;
     this.entryDescription.Text = dat.description;
     if (dat is RationalFunction)
     {
         currentRF = (RationalFunction)dat;
         this.notebook1.GetNthPage(0).ShowAll();
         this.notebook1.GetNthPage(1).HideAll();
         this.entryNumerator.Text    = currentRF.Numerators [0].ToString();
         this.entryNumerator1.Text   = currentRF.Numerators [1].ToString();
         this.entryDenominator.Text  = currentRF.Denominators [0].ToString();
         this.entryDenominator1.Text = currentRF.Denominators [1].ToString();
     }
     else if (dat is VerbalTable)
     {
         currentVT = (VerbalTable)dat;
         this.notebook1.GetNthPage(0).HideAll();
         this.notebook1.GetNthPage(1).ShowAll();
         lsVT.Clear();
         foreach (var item in ((VerbalTable)dat).items)
         {
             this.lsVT.AppendValues(item.Key, item.Value);
         }
         this.buttonDelete.Sensitive = false;
     }
     else
     {
     }
     return(true);
 }
Esempio n. 2
0
        public static List <CompuMethod> CreateBaseCompuMethods()
        {
            List <CompuMethod> ret = new List <CompuMethod> ();

            ret.AddRange(RationalFunction.CreateBaseRationalFunctions());
            ret.AddRange(VerbalTable.CreateBaseVerbalTables());
            return(ret);
        }
Esempio n. 3
0
        public static VerbalTable CreateOnOff()
        {
            VerbalTable ret = new VerbalTable();

            ret.name        = "OnOff";
            ret.description = "On and Off";
            ret.items.Add(0, "Off");
            ret.items.Add(1, "On");
            return(ret);
        }
Esempio n. 4
0
        public static VerbalTable CreateTrueFalse()
        {
            VerbalTable ret = new VerbalTable();

            ret.name        = "TrueFalse";
            ret.description = "True and False";
            ret.items.Add(0, "False");
            ret.items.Add(1, "True");
            return(ret);
        }
Esempio n. 5
0
        public static CompuMethod ParseFromXml(XmlNode node, CompuMethod ret = null)
        {
            switch (node.Name)
            {
            case "RationalFunction":
                return(RationalFunction.ParseFromXml(node, ret));

                break;

            case "VerbalTable":
                return(VerbalTable.ParseFromXml(node, ret));

                break;

            default:
                return(ret);

                break;
            }
        }
Esempio n. 6
0
        public static VerbalTable ParseFromXml(XmlNode node, VerbalTable ret = null)
        {
            if (null == ret)
            {
                ret = new VerbalTable();
            }
            ret = (VerbalTable)AbstractData.ParseFromXml(node, ret);
            XmlNode cnode = null;

            cnode = node.SelectSingleNode("items");
            if (null != cnode)
            {
                for (int i = 0; i < cnode.SelectNodes("item").Count; i++)
                {
                    XmlNode dnode = cnode.SelectNodes("item").Item(i);
                    ret.items.Add(Convert.ToInt32(dnode.SelectSingleNode("key").InnerText),
                                  dnode.SelectSingleNode("value").InnerText);
                }
            }
            return(ret);
        }
Esempio n. 7
0
        public static Group <T> ParseFromXml(XmlNode node, Group <T> ret = null)
        {
            if (null == ret)
            {
                ret = new Group <T> ();
            }
            ret.elements.Clear();
            XmlNode cnode = null;

            cnode = node.SelectSingleNode("name");
            if (null != cnode)
            {
                ret.name = cnode.InnerText;
            }
            cnode = node.SelectSingleNode("description");
            if (null != cnode)
            {
                ret.description = cnode.InnerText;
            }
            XmlNodeList cnodelist;

            if (typeof(T).Name.Equals("CompuMethod"))
            {
                cnodelist = node.SelectNodes("RationalFunction");
                for (int i = 0; i < cnodelist.Count; i++)
                {
                    Group <CompuMethod> .GAdd(RationalFunction.ParseFromXml(cnodelist.Item(i)));
                }
                cnodelist = node.SelectNodes("VerbalTable");
                for (int i = 0; i < cnodelist.Count; i++)
                {
                    Group <CompuMethod> .GAdd(VerbalTable.ParseFromXml(cnodelist.Item(i)));
                }
            }
            else
            {
                cnodelist = node.SelectNodes(typeof(T).Name);
                for (int i = 0; i < cnodelist.Count; i++)
                {
                    switch (typeof(T).Name)
                    {
                    case "Unit":
                        Group <Unit> .GAdd(Unit.ParseFromXml(cnodelist.Item(i)));

                        break;

                    case "Message":
                        Group <Message> .GAdd(Message.ParseFromXml(cnodelist.Item(i)));

                        break;

                    case "Process":
                        Group <Process> .GAdd(Process.ParseFromXml(cnodelist.Item(i)));

                        break;

                    case "Task":
                        Group <Task> .GAdd(Task.ParseFromXml(cnodelist.Item(i)));

                        break;

                    case "StateMachine":
                        Group <StateMachine> .GAdd(StateMachine.ParseFromXml(cnodelist.Item(i)));

                        break;

                    default:
                        break;
                    }
                }
            }

            return(ret);
        }