예제 #1
0
        public void Should_CreateCorrectF4Item()
        {
            var numericItem = new F4(1.5f);

            Assert.IsTrue(numericItem.Value == 1.5f);
            Assert.IsTrue(numericItem.Type == Format.F4);
        }
예제 #2
0
        public void Should_BeEqualIfNumericItemsEqual()
        {
            var numericItem  = new F4(1);
            var numericItem2 = new F4(1);

            Assert.IsTrue(numericItem.Equals(numericItem2));
        }
    protected virtual void OnTrackingFound()
    {
        if (mTrackableBehaviour)
        {
            var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true);
            var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true);
            var canvasComponents   = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true);

            // Enable rendering:
            foreach (var component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (var component in colliderComponents)
            {
                component.enabled = true;
            }

            // Enable canvas':
            foreach (var component in canvasComponents)
            {
                component.enabled = true;
            }
        }

        if (mTrackableBehaviour.TrackableName == "E1")
        {
            F1.SetActive(true);
            F2.SetActive(true);
            F3.SetActive(true);
            F4.SetActive(true);
        }
    }
예제 #4
0
        public void Should_FailEqualityForDifferetObjectTypes()
        {
            var numericItem = new F4(1);
            var obj         = "test";

            Assert.IsFalse(numericItem.Equals(obj));
        }
예제 #5
0
        private void IniciarBotao(object sender, EventArgs e)
        {
            Contador1.Text = "0";
            Contador2.Text = "0";
            Contador3.Text = "0";
            Contador4.Text = "0";
            Contador5.Text = "0";

            for (int i = 0; i < Garfo.Count(); i++)
            {
                Garfo[i].EmUso       = false;
                Filosofo[i].Pensando = false;
            }

            ControleThread = true;

            F1.Abort();
            F2.Abort();
            F3.Abort();
            F4.Abort();
            F5.Abort();

            { F1 = new Thread(Filosofo1); F1.Start(); }
            { F3 = new Thread(Filosofo3); F3.Start(); }
            { F5 = new Thread(Filosofo5); F5.Start(); }
            { F2 = new Thread(Filosofo2); F2.Start(); }
            { F4 = new Thread(Filosofo4); F4.Start(); }


            iniciar.Enabled   = false;
            Finalizar.Enabled = true;
        }
예제 #6
0
        public void Should_FailEqualityForDifferentDataTypes()
        {
            var numericItem  = new F4(1);
            var numericItem2 = new U8(5);

            Assert.IsFalse(numericItem.Equals(numericItem2));
        }
예제 #7
0
        public void Run()
        {
            var function = new F4();

            // Generate simplex with offset from 1 to 20 and in point [0.5, 0.5]
            Console.WriteLine("Case 1: Generate simplex with offset from 1 to 20 and in point [0.5, 0.5].");
            for (int i = 1; i <= 20; i++)
            {
                var opt = new NelderMeadMinimizer();
                opt.IsOutputEnabled             = false;
                opt.IsOutputPerIterationEnabled = false;
                double[] min = opt.Minimize(function, new double[] { 0.5, 0.5 }, i);
                Console.WriteLine($"offset={i}, evals={function.Evaluations}, x_min={min.Format(16)}, f(x_min)={function.Value(min).ToString("F16")}");
                function.Clear();
            }

            Console.WriteLine();

            // Generate simplex with offset from 1 to 20 and in point [20, 20]
            Console.WriteLine("Case 2: Generate simplex with offset from 1 to 20 and in point [20, 20].");
            for (int i = 1; i <= 20; i++)
            {
                var opt = new NelderMeadMinimizer();
                opt.IsOutputEnabled             = false;
                opt.IsOutputPerIterationEnabled = false;
                double[] min = opt.Minimize(function, new double[] { 20, 20 }, i);
                Console.WriteLine($"offset={i}, evals={function.Evaluations}, x_min={min.Format(16)}, f(x_min)={function.Value(min).ToString("F16")}");
                function.Clear();
            }
        }
예제 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((F4.GetHashCode() * 397) ^ F1.GetHashCode());
     }
 }
예제 #9
0
        public void Should_FailEqualityForDifferentNumericValues()
        {
            var numericItem  = new F4(1);
            var numericItem2 = new F4(2);

            Assert.IsFalse(numericItem.Equals(numericItem2));
        }
예제 #10
0
        public void Should_FailEqualityForDifferentDataTypes()
        {
            var stringItem  = new StringItem("lena", 4);
            var numericItem = new F4(5);

            Assert.IsFalse(stringItem.Equals(numericItem));
        }
예제 #11
0
 public void Start()
 {
     cli1_1.text = "";
     cli2_1.text = "";
     cli1_2.text = "";
     cli2_2.text = "";
     cli1_3.text = "";
     cli2_3.text = "";
     cli1_4.text = "";
     cli2_4.text = "";
     cli1_5.text = "";
     cli2_5.text = "";
     F1.SetActive(false);
     H1.SetActive(false);
     H11.SetActive(false);
     F2.SetActive(false);
     H2.SetActive(false);
     H22.SetActive(false);
     F3.SetActive(false);
     H3.SetActive(false);
     H33.SetActive(false);
     F4.SetActive(false);
     H4.SetActive(false);
     H44.SetActive(false);
     F5.SetActive(false);
     H5.SetActive(false);
     H55.SetActive(false);
 }
예제 #12
0
        static void Main(string[] args)
        {
            F1 f1 = new F1();

            f1.print();
            F2 f2 = new F2();

            f2.print();
            F3 f3 = new F3();

            f3.print();
            F4 f4 = new F4();

            f4.print();
            F5 f5 = new F5();

            f5.print();
            F6 f6 = new F6();

            f6.print();
            F7 f7 = new F7();

            f7.print();
            F8 f8 = new F8();

            f8.print();
            F9 f9 = new F9();

            f9.print();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            count_f1.Text = "0";
            count_f2.Text = "0";
            count_f3.Text = "0";
            count_f4.Text = "0";
            count_f5.Text = "0";

            for (int i = 0; i < Garfo.Count(); i++)
            {
                Garfo[i].EstaEmUso        = false;
                Filosofos[i].EstaPensando = false;
            }

            controlaThreads = true;

            F1.Abort();
            F2.Abort();
            F3.Abort();
            F4.Abort();
            F5.Abort();

            { F1 = new Thread(Filosofo1); F1.Start(); }
            { F3 = new Thread(Filosofo3); F3.Start(); }
            { F5 = new Thread(Filosofo5); F5.Start(); }
            { F2 = new Thread(Filosofo2); F2.Start(); }
            { F4 = new Thread(Filosofo4); F4.Start(); }
            button1.Enabled = false;
            button2.Enabled = true;
        }
예제 #14
0
        public Property testlift4()
        {
            var an = Option <double> .none();

            var bn = Option <DateTime> .none();

            var cn = Option <bool> .none();

            var dn = Option <int> .none();

            return(Prop.ForAll <Tuple <double, DateTime, bool, int> >(t =>
            {
                var(a, b, c, d) = t;
                var fl = F4.liftOption();
                assertSome(F4(a, b, c, d), fl(a.some(), b.some(), c.some(), d.some()));
                assertNone(fl(an, b.some(), c.some(), d.some()));
                assertNone(fl(an, b.some(), c.some(), dn));
                assertNone(fl(an, bn, c.some(), d.some()));
                assertNone(fl(an, bn, c.some(), dn));
                assertNone(fl(an, b.some(), cn, d.some()));
                assertNone(fl(an, bn, cn, dn));
                assertNone(fl(a.some(), bn, c.some(), d.some()));
                assertNone(fl(a.some(), b.some(), cn, dn));
                assertNone(fl(a.some(), bn, cn, d.some()));
                assertNone(fl(a.some(), bn, cn, dn));
            }));
        }
예제 #15
0
 private void A1_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5");
     if (Key_IsDown((uint)0) == "X")
     {
         HostMenuMain.Stop();
         B1.Start();
     }
     if (Key_IsDown((uint)0) == "R1")
     {
         HostMenuMain.Stop();
         Client1.Start();
     }
     if (Key_IsDown((uint)0) == "R3 + L3")
     {
         HostMenuMain.Stop();
         B1.Stop();
         B2.Stop();
         B3.Stop();
         B4.Stop();
         B5.Stop();
         Client1.Stop();
         C1.Stop();
         C2.Stop();
         C3.Stop();
         C4.Stop();
         ResetMenu.Stop();
         D1.Stop();
         D2.Stop();
         D3.Stop();
         D4.Stop();
         D5.Stop();
         AccountMenu.Stop();
         E1.Stop();
         E2.Stop();
         E3.Stop();
         E4.Stop();
         E5.Stop();
         TeleportMenu.Stop();
         F1.Stop();
         F2.Stop();
         F3.Stop();
         F4.Stop();
         VisionMenu.Stop();
         G1.Stop();
         G2.Stop();
         G3.Stop();
         G4.Stop();
         G5.Stop();
         G6.Stop();
         OtherMenu.Stop();
         H1.Stop();
         PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed");
         simpleButton2.Enabled           = true;
         toolStripStatusLabel2.Text      = "Not Started !";
         toolStripStatusLabel2.ForeColor = Color.Red;
         simpleButton3.Enabled           = false;
     }
 }
예제 #16
0
 public Property curryF4Test()
 {
     return(Prop.ForAll <Tuple <double, DateTime, bool, int> >(t => {
         var(a, b, c, d) = t;
         var fc = F4.curry()(a);
         return F4(a, b, c, d) == fc(b)(c)(d);
     }));
 }
예제 #17
0
 public Property pApplyMultiple_F4Test()
 {
     return(Prop.ForAll <Tuple <double, DateTime, bool, int> >(t => {
         var(a, b, c, d) = t;
         var fap = F4.pApply1(a).pApply1(b).pApply1(c);
         return F4(a, b, c, d) == fap(d);
     }));
 }
예제 #18
0
 public Property uncurryF4Test()
 {
     return(Prop.ForAll <Tuple <double, DateTime, bool, int> >(t => {
         var(a, b, c, d) = t;
         var fnew = F4.curry().uncurry();
         return F4(a, b, c, d) == fnew(a, b, c, d);
     }));
 }
예제 #19
0
        private void Filosofo4()
        {
            int tempo        = sorteio.Next(3000, 6000);
            int TempoComendo = tempo / Controlatempo;

            while (ControleThread)
            {
                if (Garfo[2].EmUso == true || Garfo[3].EmUso == true)
                {
                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        ListaTela.Items.Add(Filosofo[3].Nome + " está pensando");
                        Status4.Text = "Pensando";
                    });

                    Thread.Sleep(2000);
                }
                else
                {
                    Semaforo.WaitOne();
                    {
                        Filosofo[3].Pensando = false;
                        Garfo[2].EmUso       = true;
                        Garfo[3].EmUso       = true;
                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            ListaTela.Items.Add(Filosofo[3].Nome + " está  comendo");
                            Status4.Text = "Comendo";
                            ContadorFilosofo4++;

                            Contador4.Text = ContadorFilosofo4.ToString();
                        });

                        Thread.Sleep(TempoComendo);

                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            ListaTela.Items.Add(Filosofo[3].Nome + " está  pensando");
                            Status4.Text = "Pensando";
                        });
                        Filosofo[3].Pensando = true;
                        Garfo[2].EmUso       = false;
                        Garfo[3].EmUso       = false;
                    }
                    Semaforo.Release();
                    if (ContadorFilosofo4 == 5)
                    {
                        F4.Abort();
                        return;
                    }
                }
            }
        }
예제 #20
0
 protected virtual void Start()
 {
     mTrackableBehaviour = GetComponent <TrackableBehaviour>();
     if (mTrackableBehaviour)
     {
         mTrackableBehaviour.RegisterTrackableEventHandler(this);
     }
     F1.SetActive(false);
     F2.SetActive(false);
     F3.SetActive(false);
     F4.SetActive(false);
 }
예제 #21
0
        public void Run()
        {
            var function = new F4();

            // Nelder-Mead search
            var opt1 = new NelderMeadMinimizer();

            opt1.IsOutputPerIterationEnabled = false;
            opt1.Minimize(function, new double[] { 5, 5 });

            // Hooke-Jeeves pattern search
            var opt2 = new HookeJeevesMinimizer();

            opt2.IsOutputPerIterationEnabled = false;
            opt2.Minimize(function, new double[] { 5, 5 });
        }
예제 #22
0
 private void simpleButton3_Click(object sender, EventArgs e)
 {
     MainMenu.Stop();
     HostMenuMain.Stop();
     B1.Stop();
     B2.Stop();
     B3.Stop();
     B4.Stop();
     B5.Stop();
     Client1.Stop();
     C1.Stop();
     C2.Stop();
     C3.Stop();
     C4.Stop();
     ResetMenu.Stop();
     D1.Stop();
     D2.Stop();
     D3.Stop();
     D4.Stop();
     D5.Stop();
     AccountMenu.Stop();
     E1.Stop();
     E2.Stop();
     E3.Stop();
     E4.Stop();
     E5.Stop();
     TeleportMenu.Stop();
     F1.Stop();
     F2.Stop();
     F3.Stop();
     F4.Stop();
     VisionMenu.Stop();
     G1.Stop();
     G2.Stop();
     G3.Stop();
     G4.Stop();
     G5.Stop();
     G6.Stop();
     OtherMenu.Stop();
     H1.Stop();
     PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed");
     toolStripStatusLabel2.Text      = "Not Started !";
     toolStripStatusLabel2.ForeColor = Color.Red;
     simpleButton2.Enabled           = true;
     simpleButton3.Enabled           = false;
 }
예제 #23
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            F1.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F1.FileName.ToString());
            F2.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F2.FileName.ToString());
            F3.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F3.FileName.ToString());
            F4.SaveAs(Request.PhysicalApplicationPath + ".//" + F4.FileName.ToString());
            a = "Product_img/" + F1.FileName.ToString();
            b = "Product_img/" + F2.FileName.ToString();
            c = "Product_img/" + F3.FileName.ToString();
            d = "" + F4.FileName.ToString();
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into laptop values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + b.ToString() + "','" + c.ToString() + "','" + a.ToString() + "','" + d.ToString() + "')";
            cmd.ExecuteNonQuery();
            con.Close();
        }
예제 #24
0
    public void ClearMenuAttempts()
    {
        F1.SetActive(false);
        H1.SetActive(false);
        H11.SetActive(false);
        F2.SetActive(false);
        H2.SetActive(false);
        H22.SetActive(false);
        F3.SetActive(false);
        H3.SetActive(false);
        H33.SetActive(false);
        F4.SetActive(false);
        H4.SetActive(false);
        H44.SetActive(false);
        F5.SetActive(false);
        H5.SetActive(false);
        H55.SetActive(false);

        cli1_1.SetText(""); cli2_1.SetText("");
        cli1_2.SetText(""); cli2_2.SetText("");
        cli1_3.SetText(""); cli2_3.SetText("");
        cli1_4.SetText(""); cli2_4.SetText("");
        cli1_5.SetText(""); cli2_5.SetText("");
    }
예제 #25
0
 private void F4_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5T^7eleport ^5M^7enu^5\n\nKill\nDown the map\nBack to map\n^2-->^5Sky");
     if (Key_IsDown((uint)0) == "R1")
     {
         F4.Stop();
         F1.Start();
     }
     if (Key_IsDown((uint)0) == "X")
     {
         byte[] buffer = new byte[] { 0x44, 0x2E, 0xF9, 0x9A, 0x43, 0xCC, 0xE6, 0x66, 0x45, 0x0E, 0x63, 0xAD, 0x00 };
         PS3.SetMemory(0x012272F4, buffer);
     }
     if (Key_IsDown((uint)0) == "R3")
     {
         F4.Stop();
         HostMenuMain.Start();
     }
     if (Key_IsDown((uint)0) == "L1")
     {
         F4.Stop();
         F3.Start();
     }
 }
예제 #26
0
 public void Continue <T, U, V, W, R>(F4 <T, U, V, W, R> m)
 {
     PrivateContinue(m);
 }
예제 #27
0
 public void Spawn <T, U, V, W, R>(F4 <T, U, V, W, R> m)
 {
     PrivateSpawn(m);
 }
예제 #28
0
 public void Pool <T, U, V, W, R>(F4 <T, U, V, W, R> m)
 {
     PrivatePool(m);
 }
예제 #29
0
 public void SyncContext <T, U, V, W, R>(F4 <T, U, V, W, R> m)
 {
     SyncContext(m);
 }
예제 #30
0
 public void Do <T, U, V, W, R>(F4 <T, U, V, W, R> m)
 {
     PrivateDo(m);
 }