コード例 #1
0
 public SkynetActor(IActor parent, long number, long size, long dv, IFuture <long> future)
 {
     _number   = number;
     _parent   = parent;
     _future   = future;
     _actorQtt = dv;
     Become(
         new Behavior <long>((i) =>
     {
         _accumulator += i;
         _actorQtt--;
         if (_parent != null)
         {
             if (_actorQtt == 0)
             {
                 _parent.SendMessage(_accumulator);
             }
         }
         else
         {
             if ((future != null) && (_actorQtt == 0))
             {
                 future.SendMessage(_accumulator);
             }
         }
     }),
         new Behavior <string>((s) =>
     {
         if (size != 1)
         {
             for (int i = 0; i < dv; i++)
             {
                 var sub_num = _number + (i * (size / dv));
                 new SkynetActor(this, sub_num, size / dv, dv, null);
             }
         }
         else
         {
             _parent.SendMessage(_number);
         }
     }));
     SendMessage("start");
 }
コード例 #2
0
 public void AskData(IFuture <string> future)
 {
     CheckArg.Future(future);
     future.SendMessage(fData);
 }
コード例 #3
0
 private void GetCurrentState(IFuture <TState> future) => future.SendMessage(Current);
コード例 #4
0
 private void DoFlush(TextWriterActor actor, IFuture <bool> future)
 {
     fStream.Flush();
     future.SendMessage(true);
 }
コード例 #5
0
 public void DecoratedMessage(string s)
 {
     fAnswer = s;
     future.SendMessage(s);
 }
コード例 #6
0
 private void GetValue(IFuture <T> future) => future.SendMessage(((StateBehaviors <T>)LinkedTo).Value);
コード例 #7
0
        private void DoGetAll(IFuture future)
        {
            IEnumerable <string> list = fShardList.ToList().AsEnumerable();

            future.SendMessage(list);
        }
コード例 #8
0
 internal void DecoratedMessage(string s)
 {
     future.SendMessage(s);
 }