Ejemplo n.º 1
0
 private void SetImediateFormat(char[] instruct)
 {
     if (CBR.DecodeRegisterSource1)
     {
         var firstSourceOperator = Cpu.InstructionRegisterOpSource1.GetValue().GetBitArrayFromString().GetIntFromBitArray();
         if (firstSourceOperator >= 4 && firstSourceOperator <= 10)
         {
             instruct[firstSourceOperator] = '1';
         }
     }
     if (CBR.DecodeRegisterSource2)
     {
         var secondSourceOperator = Cpu.InstructionRegisterOpSource2.GetValue().GetBitArrayFromString().GetIntFromBitArray();
         if (secondSourceOperator >= 4 && secondSourceOperator <= 10)
         {
             instruct[secondSourceOperator] = '1';
         }
     }
     if (CBR.DecodeRegisterDestiny)
     {
         var destinyOperator = Cpu.InstructionRegisterOpDestiny.GetValue().GetBitArrayFromString().GetIntFromBitArray();
         if (destinyOperator >= 4 && destinyOperator <= 10)
         {
             instruct[destinyOperator + 1] = '1';
         }
     }
     CBR.SetControlSignalInstruction(instruct);
 }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            _cbr = new CBR();
            _pen = new Pen(Color.Black);

            this.CreateGraphics().SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Init();
        }
Ejemplo n.º 3
0
        private static void MeasureRouter(XDocument xMessage, String routerConfigFileName, ValidatorImplementation implementation)
        {
            CBR router = CBR.Deserialize(routerConfigFileName);

            router.Compile(implementation);

            Meter.MeasureActionByTime(() =>
            {
                String selectedPredicateId = router.Route(xMessage);
            }, "Route");
        }
Ejemplo n.º 4
0
        public void GetAnswerTest()
        {
            Func <string, string[]> splitter = s => s.Split(null);

            var cbr = new CBR(splitter);

            string ans1 = "필떵ㅎ", ans2 = "땡큐!", ans3 = "글세..";

            cbr.AddConversation("what your name", ans1);
            cbr.AddConversation("that pretty name", ans2);
            cbr.AddConversation("what you doing now", ans3);

            Assert.AreEqual(ans2, cbr.GetAnswer("what pretty name"));
        }
Ejemplo n.º 5
0
        public void AddConversationTest()
        {
            Func <string, string[]> splitter = s => s.Split(null);

            var cbr = new CBR(splitter);

            cbr.AddConversation("what your name", "필떵ㅎ");
            cbr.AddConversation("that pretty name", "Thank you!");
            cbr.AddConversation("what you doing now", "Well..");

            var what = cbr._corpuses[0];

            Assert.AreEqual(what.Word, "what");
            Assert.AreEqual(3, what._sentenceIdx[0].Count);
        }