Exemple #1
0
            public Logic(Detacher <T> stage) : base(stage.Shape)
            {
                _stage = stage;

                SetHandler(stage.Inlet, this);
                SetHandler(stage.Outlet, this);
            }
Exemple #2
0
 public Logic(Detacher <T> stage) : base(stage.Shape)
 {
     _stage = stage;
     SetHandler(stage.Inlet,
                onPush: () =>
     {
         var outlet = stage.Outlet;
         if (IsAvailable(outlet))
         {
             var inlet = stage.Inlet;
             Push(outlet, Grab(inlet));
             TryPull(inlet);
         }
     },
                onUpstreamFinish: () =>
     {
         if (!IsAvailable(stage.Inlet))
         {
             CompleteStage();
         }
     });
     SetHandler(stage.Outlet,
                onPull: () =>
     {
         var inlet = stage.Inlet;
         if (IsAvailable(inlet))
         {
             var outlet = stage.Outlet;
             Push(outlet, Grab(inlet));
             if (IsClosed(inlet))
             {
                 CompleteStage();
             }
             else
             {
                 Pull(inlet);
             }
         }
     });
 }