예제 #1
0
 public Automat(Automat o)
 {
     A          = o.A;
     S          = o.S;
     Z          = o.Z;
     stateIndex = o.stateIndex;
 }
예제 #2
0
파일: Form1.cs 프로젝트: a-27m/vssdb
        private void openToolStripButton_Click(object sender, EventArgs e)
        {
            Automat auto = null;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Form child = null;

                object[] A;
                object[] Z;
                object[] S;
                int[,] ν;
                //int[,] ζ;

                // reading automat
                try
                {
                    StreamReader file = new StreamReader(openFileDialog1.FileName);
                    string       type = GetSplittedLine(file)[0];
                    A = GetSplittedLine(file);
                    Z = GetSplittedLine(file);
                    S = GetSplittedLine(file);
                    switch (type)
                    {
                    case "MM":
                        #region Stack-memory automat loading
                        object[] M;
                        int[][,] MDev;
                        List <MMAutomatAct[]> rulesList;
                        ReadMMFromFile(A.Length, S.Length, file, out M, out MDev, out rulesList);

                        auto  = new MMAutomat(A, Z, S, M, MDev, rulesList.ToArray());
                        child = new MMAutomatChlid((MMAutomat)auto);
                        (child as MMAutomatChlid).machine.Step += new MMAutomat.MMStepDelegate(machine_Step);
                        #endregion
                        break;

                    case "Mili":
                        ν    = TableRead(file, S.Length, A.Length);
                        auto = new AutomatMili(A, Z, S, ν,
                                               TableRead(file, S.Length, A.Length));
                        child = new MDIChildTemplate((TerminalAutomat)auto);
                        (child as MDIChildTemplate).machine.Step += new TerminalStepDelegate(machine_Step);
                        break;

                    case "Mura":
                        ν    = TableRead(file, S.Length, A.Length);
                        auto = new AutomatMura(A, Z, S, ν,
                                               TableRead(file, S.Length));
                        child = new MDIChildTemplate((TerminalAutomat)auto);
                        break;

                    default:
                        break;
                    }
                }
                catch (IOException excp)
                {
                    MessageBox.Show(excp.Message);
                    return;
                }

                if (child == null)
                {
                    return;
                }
                child.MdiParent = this;
                child.Text      = openFileDialog1.FileName;
                child.Show();
            }
        }