Exemplo n.º 1
0
            public string Execute(string query)
            {
                string[] temp      = query.Split(' ');
                var      command   = temp[0];
                var      cloneN    = int.Parse(temp[1]);
                int      programmN = 0;

                if (temp.Length > 2)
                {
                    programmN = int.Parse(temp[2]);
                }
                Clone clone = cloneList[cloneN - 1];

                switch (command)
                {
                case "learn":
                    clone.Learn(programmN);
                    return(null);

                case "rollback":
                    clone.Rollback();
                    return(null);

                case "relearn":
                    clone.Relearn();
                    return(null);

                case "clone":
                    cloneList.Add(new Clone(new LinkedStack(clone.CopyHeadL()),
                                            new LinkedStack(clone.CopyHeadR())));
                    return(null);

                case "check":
                    return(clone.Check());

                default:
                    break;
                }
                return(null);
            }