예제 #1
0
        private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            double left  = 0;
            double right = 0;
            double step  = 0;
            ContinuousFuzzySet <double, double> ConSet = null;
            DiscreteFuzzyStringSet DiscSet             = null;
            Params p = new Params();

            if (radioButton2.Checked)
            {
                try
                {
                    if (comboBox1.SelectedIndex == 1 ||
                        comboBox1.SelectedIndex == 0)
                    {
                        p.TryParse(textBox5.Text, textBox6.Text);
                    }
                    else if (comboBox1.SelectedIndex == 2)
                    {
                        p.TryParse(textBox5.Text, textBox6.Text, textBox7.Text);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Неверный аргумент!", "Ошибка");
                    return;
                }
                try
                {
                    Double.TryParse(textBox1.Text, out left);
                    Double.TryParse(textBox2.Text, out right);
                    Double.TryParse(textBox3.Text, out step);
                }
                catch (Exception)
                {
                    MessageBox.Show("Неверный аргумент!", "Ошибка");
                    return;
                }
                ConSet = CreateContinuousSet(left, right, step, p.a, p.b, p.c);
                ElementsCache.Add(ConSet);
            }
            else if (radioButton1.Checked)
            {
                string[] src = textBox4.Text.Split(new string[] { " ", ".", ",", ":", "\r\n" },
                                                   StringSplitOptions.RemoveEmptyEntries);
                if (comboBox2.SelectedIndex < 0 && comboBox3.SelectedIndex < 0 &&
                    comboBox4.SelectedIndex < 0 && comboBox1.SelectedIndex != 3)
                {
                    MessageBox.Show("Неверный аргумент!", "Ошибка");
                    return;
                }
                DiscSet = CreateDiscreteStringSet(comboBox2.SelectedIndex,
                                                  comboBox3.SelectedIndex, comboBox4.SelectedIndex, src);
                ElementsCache.Add(DiscSet);
            }
            listBox1.Items.Add("set #" + ElementsCache.Count.ToString());
        }
예제 #2
0
        private void удалитьИзКэшаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int id = listBox1.SelectedIndex;

            if (id == -1)
            {
                return;
            }
            ElementsCache.RemoveAt(id);
            listBox1.Items.RemoveAt(id);
        }
예제 #3
0
        private void графикToolStripMenuItem_Click(object sender, EventArgs e)
        {
            chart1.ResetAutoValues();
            int id = listBox1.SelectedIndex;
            ContinuousFuzzySet <double, double> ConSet = null;
            DiscreteFuzzyStringSet DiskSet             = null;

            if (ElementsCache.GetAt(id).GetType() == typeof(ContinuousFuzzySet <double, double>))
            {
                ConSet = (ContinuousFuzzySet <double, double>)ElementsCache.GetAt(id);
                ViewSet(ConSet, chart1);
            }
            else if (ElementsCache.GetAt(id).GetType() == typeof(DiscreteFuzzyStringSet))
            {
                DiskSet = (DiscreteFuzzyStringSet)ElementsCache.GetAt(id);
                ViewSet(DiskSet, chart1);
            }
        }
예제 #4
0
 private void очиститьКэшToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ElementsCache.Clear();
     listBox1.Items.Clear();
 }