Exemplo n.º 1
0
        //Запуск
        private void _Run__Click(object sender, EventArgs e)
        {
            Reset();

            int count  = (int)Keys_Count.Value;
            int length = (int)Max_Key_Length.Value;

            CreateDataArray(count, length);
            Thread.Sleep(50);
            CreateExDataArray(data_array, count, length);
            if (Selected_Algorithms.GetItemChecked(CHAIN_METHOD))
            {
                Chain chain_method = new Chain(data_array, data_array_ex);
                chain_method.GenerateKeys();
                chain_method.SearchKeys();
                int[] stats = chain_method.GetParams();
                int   idx   = Stats.Rows.Add();
                Stats.Rows[idx].HeaderCell.Value                    = "Метод цепочек";
                Stats.Rows[idx].Cells[PARAM_TIME].Value             = stats[PARAM_TIME];
                Stats.Rows[idx].Cells[PARAM_FOUND_KEYS_COUNT].Value = stats[PARAM_FOUND_KEYS_COUNT];
                Stats.Rows[idx].Cells[PARAM_CMPS].Value             = stats[PARAM_CMPS];
            }
            if (Selected_Algorithms.GetItemChecked(SORTED_ARRAY))
            {
                SortedArray sorted_array = new SortedArray(data_array, data_array_ex);
                sorted_array.SearchKeys();
                int[] stats = sorted_array.GetParams();
                int   idx   = Stats.Rows.Add();
                Stats.Rows[idx].HeaderCell.Value                    = "Упорядоченный массив ключей";
                Stats.Rows[idx].Cells[PARAM_TIME].Value             = stats[PARAM_TIME];
                Stats.Rows[idx].Cells[PARAM_FOUND_KEYS_COUNT].Value = stats[PARAM_FOUND_KEYS_COUNT];
                Stats.Rows[idx].Cells[PARAM_CMPS].Value             = stats[PARAM_CMPS];
            }
            if (Selected_Algorithms.GetItemChecked(DIGITAL_TREE))
            {
                DigitalTree tree = new DigitalTree(data_array, data_array_ex);
                tree.GenerateKeys();
                tree.SearchKeys();
                int[] stats = tree.GetParams();
                int   idx   = Stats.Rows.Add();
                Stats.Rows[idx].HeaderCell.Value                    = "Дерево цифрового поиска";
                Stats.Rows[idx].Cells[PARAM_TIME].Value             = stats[PARAM_TIME];
                Stats.Rows[idx].Cells[PARAM_FOUND_KEYS_COUNT].Value = stats[PARAM_FOUND_KEYS_COUNT];
                Stats.Rows[idx].Cells[PARAM_CMPS].Value             = stats[PARAM_CMPS];
            }
            RunMultiplySelection();
        }
Exemplo n.º 2
0
        private void RunMultiplySelection()
        {
            int count  = (int)Keys_Count.Value;
            int length = (int)Max_Key_Length.Value;

            if (Selected_Algorithms.GetItemChecked(CHAIN_METHOD))
            {
                System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series();
                series.ChartArea   = "ChartArea1";
                series.ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                series.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
                series.Legend      = "Legend1";
                series.Name        = "Метод цепочек";
                Graph.Series.Add(series);
            }
            if (Selected_Algorithms.GetItemChecked(SORTED_ARRAY))
            {
                System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series();
                series.ChartArea   = "ChartArea1";
                series.ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                series.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
                series.Legend      = "Legend1";
                series.Name        = "Упорядоченный массив ключей";
                Graph.Series.Add(series);
            }
            if (Selected_Algorithms.GetItemChecked(DIGITAL_TREE))
            {
                System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series();
                series.ChartArea   = "ChartArea1";
                series.ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                series.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
                series.Legend      = "Legend1";
                series.Name        = "Дерево цифрового поиска";
                Graph.Series.Add(series);
            }

            for (int i = 0; i < (int)Cycles_Count.Value; i++)
            {
                CreateDataArray(count, length);
                Thread.Sleep(50);
                CreateExDataArray(data_array, count, length);
                if (Selected_Algorithms.GetItemChecked(CHAIN_METHOD))
                {
                    Chain chain_method = new Chain(data_array, data_array_ex);
                    chain_method.GenerateKeys();
                    chain_method.SearchKeys();
                    int[] stats = chain_method.GetParams();
                    Graph.Series.FindByName("Метод цепочек").Points.AddXY(count, stats[PARAM_TIME]);
                }
                if (Selected_Algorithms.GetItemChecked(SORTED_ARRAY))
                {
                    SortedArray sorted_array = new SortedArray(data_array, data_array_ex);
                    sorted_array.SearchKeys();
                    int[] stats = sorted_array.GetParams();
                    Graph.Series.FindByName("Упорядоченный массив ключей").Points.AddXY(count, stats[PARAM_TIME]);
                }
                if (Selected_Algorithms.GetItemChecked(DIGITAL_TREE))
                {
                    DigitalTree tree = new DigitalTree(data_array, data_array_ex);
                    tree.GenerateKeys();
                    tree.SearchKeys();
                    int[] stats = tree.GetParams();
                    Graph.Series.FindByName("Дерево цифрового поиска").Points.AddXY(count, stats[PARAM_TIME]);
                }
                count  += (int)Increase_Keys_Count.Value;
                length += (int)Increase_Key_Length.Value;
            }
        }