Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 private void DoAcc(Accumulators acc)
 {
     foreach (var item in observers)
     {
         item.SendMessage(acc);
     }
 }
Exemplo n.º 3
0
        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);
        }