Exemplo n.º 1
0
        public override string ToString()
        {
            if (Approved)
            {
                return("[OK] " + RemoteMovie);
            }

            return("[Rejected " + Rejections.Count() + "]" + RemoteMovie);
        }
Exemplo n.º 2
0
Arquivo: MainForm.cs Projeto: sw9t/smo
        void SolveRejections()
        {
            double Q, g, day, lambda, d, t;

            try
            {
                Q   = double.Parse(Q_TB.Text);
                g   = double.Parse(g_TB.Text);
                day = double.Parse(day_TB.Text);
                if (lambdaCheck.Checked)
                {
                    lambda = double.Parse(lambda_TB.Text);
                }
                else
                {
                    lambda         = Q / (g * day);
                    lambda_TB.Text = lambda.ToString();
                }
                d = double.Parse(d_TB.Text);
                t = double.Parse(t_TB.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Были введены недопустимые данные. Проверьте корректность вводимых данных.",
                                "Ошибка распознавания данных",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int    channels = (int)ChannelsNUD.Value;
            int    percents = (int)PercentsNUD.Value;
            double ro       = Rejections.get_ro(t, lambda);

            double[] Pi = Rejections.get_Pi(channels, ro);
            for (int i = 0; i < channels + 1; i++)
            {
                SysStatesLV.Items.Add(new ListViewItem("X" + i)
                {
                    SubItems = { i + " каналов", channels - i + " каналов" }
                });
            }
            for (int i = 0; i < Pi.Length; i++)
            {
                SysProbabilitesLV.Items.Add(new ListViewItem("P" + i)
                {
                    SubItems = { Pi[i].ToString() }
                });
            }
            p_otk.Text = Rejections.get_p_otkaza(Pi, channels).ToString();
            p_obs.Text = Rejections.get_p_obslujivania(double.Parse(p_otk.Text)).ToString() + " ≈ " +
                         Math.Round(Rejections.get_p_obslujivania(double.Parse(p_otk.Text)) * 100) + "%";
            if (Math.Round(Rejections.get_p_obslujivania(double.Parse(p_otk.Text)) * 100) < percents)
            {
                p_obs.ForeColor       = Color.DarkRed;
                AddChannelBtn.Visible = true;
            }
            else
            {
                p_obs.ForeColor       = Color.Lime;
                AddChannelBtn.Visible = false;
            }
            A.Text  = Rejections.get_A(lambda, Rejections.get_p_obslujivania(double.Parse(p_otk.Text))).ToString();
            nz.Text = Rejections.get_n_zaneatih(double.Parse(A.Text), t).ToString();
            ns.Text = Rejections.get_n_svobodnih(channels, double.Parse(nz.Text)).ToString();
            kz.Text = Rejections.get_k_zaneatih(channels, double.Parse(nz.Text)) + " ≈ " +
                      Math.Round(Rejections.get_k_zaneatih(channels, double.Parse(nz.Text)) * 100) + "%";
            kpr.Text = Rejections.get_k_prostoia(Rejections.get_k_zaneatih(channels, double.Parse(nz.Text))) + " ≈ " +
                       Math.Round(Rejections.get_k_prostoia(Rejections.get_k_zaneatih(channels, double.Parse(nz.Text))) * 100) + "%";
            t_ozh.Text     = "-";
            t_ozh.Enabled  = t_ozh_lbl.Enabled = false;
            t_sist.Text    = "-";
            t_sist.Enabled = t_sist_lbl.Enabled = false;
            r.Text         = "-";
            r.Enabled      = r_lbl.Enabled = false;
            S.Text         = Rejections.get_s(channels, g, d).ToString();
        }