Exemplo n.º 1
0
        private void getAutonataTable()
        {
            dataGridView5.Rows.Clear();
            dataGridView5.Columns.Clear();

            EnsembleGraphNode ens = (EnsembleGraphNode)treeView1.SelectedNode.Tag;

            string[,] table = ens.getAutomataTable(checkedListBox1.CheckedItems);

            /*dataGridView1.Columns.Add((j + 1).ToString(), (j + 1).ToString());
             * i = dataGridView1.Columns.Count;
             * dataGridView1.Columns[i - 1].Width = 40;
             * dataGridView1.Rows.Add();
             * dataGridView1.Rows[i - 1].HeaderCell.Value = (j + 1).ToString();*/

            for (int i = 1; i <= ens.getAutomataWidth() - 1; i++)
            {
                dataGridView5.Columns.Add(table[0, i].ToString(), table[0, i].ToString());
                dataGridView5.Columns[i - 1].Width = 40;
            }


            for (int i = 1; i <= ens.getAutomataHeigh(checkedListBox1.CheckedItems) - 1; i++)
            {
                dataGridView5.Rows.Add();
                dataGridView5.Rows[i - 1].HeaderCell.Value = table[i, 0].ToString();
            }

            for (int i = 1; i < ens.getAutomataHeigh(checkedListBox1.CheckedItems); i++)
            {
                for (int j = 1; j < ens.getAutomataWidth(); j++)
                {
                    dataGridView5.Rows[i - 1].Cells[j - 1].Value = table[i, j].ToString();
                }
            }
        }
Exemplo n.º 2
0
        public void SetUpEdgesAndCosts(string[,] table, EnsembleGraphNode ens, CheckedListBox checkedListBox1)
        {
            _graph = new AdjacencyGraph <string, Edge <string> >();
            _costs = new Dictionary <Edge <string>, string>();

            //for(int i=0; i<table.Length)
            for (int j = 1; j <= ens.getAutomataWidth() - 1; j++)                                 // по столбцам
            {
                for (int i = 1; i <= ens.getAutomataHeigh(checkedListBox1.CheckedItems) - 1; i++) // по строкам
                {
                    // AddEdgeWithCosts(table[0, j].ToString(), table[i, j].ToString(), 1);
                    AddEdgeWithCosts(table[0, j].ToString(), table[i, j].ToString(), table[i, 0].ToString());
                }
            }

/*            AddEdgeWithCosts("6", "7", 2.0);
 *          AddEdgeWithCosts("6", "1", 1.0);
 *          AddEdgeWithCosts("6", "8", 5.0);
 *          AddEdgeWithCosts("7", "6", 3.0);
 *          AddEdgeWithCosts("7", "2", 3.0);
 *          AddEdgeWithCosts("7", "8", 3.0);
 *          AddEdgeWithCosts("8", "6", 3.0);
 *          AddEdgeWithCosts("8", "2", 2.0);
 *          AddEdgeWithCosts("1", "6", 2.0);
 *          AddEdgeWithCosts("1", "3", 2.0);
 *          AddEdgeWithCosts("2", "6", 2.0);
 *          AddEdgeWithCosts("2", "1", 4.0);
 *          AddEdgeWithCosts("2", "3", 2.0);
 *          AddEdgeWithCosts("3", "1", 1.0);
 *          AddEdgeWithCosts("3", "5", 5.0);
 *          AddEdgeWithCosts("3", "4", 2.0);
 *          AddEdgeWithCosts("4", "3", 3.0);
 *          AddEdgeWithCosts("4", "2", 3.0);
 *          AddEdgeWithCosts("5", "2", 2.0);
 *          AddEdgeWithCosts("5", "3", 3.0);
 *          AddEdgeWithCosts("5", "4", 3.0);*/
        }