Beispiel #1
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;
            }
        }
Beispiel #2
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);
        }