コード例 #1
0
ファイル: CalcBehavior.cs プロジェクト: lulzzz/ARnActorModel
        private void Update(Tuple <CalcEvent, string> evt)
        {
            string data = evt.Item2;

            switch (evt.Item1)
            {
            case CalcEvent.Clear: { accumulators = new Accumulators(); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Digit: { accumulators = accumulators.Enter(data); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Plus: { accumulators = accumulators.Plus(); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Moins: { accumulators = accumulators.Moins(); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Mult: { accumulators = accumulators.Mult(); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Div: { accumulators = accumulators.Div(); LinkedActor.SendMessage(accumulators); break; }

            case CalcEvent.Sign:
            {
                accumulators = accumulators.Sign();
                LinkedActor.SendMessage(accumulators);
                break;
            }

            default: break;
            }
        }
コード例 #2
0
ファイル: CalcBehavior.cs プロジェクト: lulzzz/ARnActorModel
 private void DoAcc(Accumulators acc)
 {
     foreach (var item in observers)
     {
         item.SendMessage(acc);
     }
 }
コード例 #3
0
ファイル: CalcBehavior.cs プロジェクト: lulzzz/ARnActorModel
        public Accumulators Mult()
        {
            var clone = new Accumulators()
            {
                Accumulator = this.MultAcc
            };

            clone.PlusAcc  = clone.Accumulator;
            clone.MoinsAcc = clone.Accumulator;
            clone.MultAcc  = 0;
            clone.DivAcc   = 0;
            return(clone);
        }