Esempio n. 1
0
        public void request(Chameneo creature, Action <object> success = null, Action <Exception> failure = null)
        {
            var __success = success;
            var __failure = failure;

            __enter(() => __advance(__concurrentrequest(creature, __success, __failure).GetEnumerator()), failure);
        }
Esempio n. 2
0
 private IEnumerable <Expression> __concurrentrequest(Chameneo creature, Action <object> __success, Action <Exception> __failure)
 {
     if (_first != null)
     {
         //perform meeting
         var firstColor = _first.Colour;
         _first.meet(creature, creature.Colour);
         creature.meet(_first, firstColor);
         //prepare for next
         _first = null;
         _meetings--;
         if (_meetings == 0)
         {
             Node.Stop();
         }
     }
     else
     {
         _first = creature;
     }
     {
         __dispatch("request");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
Esempio n. 3
0
        public void meet(Chameneo other, Color color, Action <object> success = null, Action <Exception> failure = null)
        {
            var __success = success;
            var __failure = failure;

            __enter(() => __advance(__concurrentmeet(other, color, __success, __failure).GetEnumerator()), failure);
        }
Esempio n. 4
0
        public void request(Chameneo creature, CancellationToken cancellation, Action <object> success, Action <Exception> failure)
        {
            var __success      = success;
            var __failure      = failure;
            var __cancellation = cancellation;

            __enter(() => __advance(__concurrentrequest(creature, __cancellation, __success, __failure).GetEnumerator()), failure);
        }
Esempio n. 5
0
        public Task <object> request(Chameneo creature, CancellationToken cancellation)
        {
            var                completion     = new TaskCompletionSource <object>();
            Action <object>    __success      = (__res) => completion.SetResult((object)__res);
            Action <Exception> __failure      = (__ex) => completion.SetException(__ex);
            var                __cancellation = cancellation;

            __enter(() => __advance(__concurrentrequest(creature, __cancellation, __success, __failure).GetEnumerator()), __failure);
            return(completion.Task);
        }
Esempio n. 6
0
        public Task <object> request(Chameneo creature, bool async)
        {
            if (!async)
            {
                throw new InvalidOperationException("use async: true");
            }
            var                completion = new TaskCompletionSource <object>();
            Action <object>    __success  = (__res) => completion.SetResult((object)__res);
            Action <Exception> __failure  = (__ex) => completion.SetException(__ex);

            __enter(() => __advance(__concurrentrequest(creature, __success, __failure).GetEnumerator()), __failure);
            return(completion.Task);
        }
Esempio n. 7
0
 private IEnumerable <Expression> __concurrentmeet(Chameneo other, Color color, CancellationToken __cancellation, Action <object> __success, Action <Exception> __failure)
 {
     Colour = ColorUtils.Compliment(Colour, color);
     Meetings++;
     if (other == this)
     {
         MeetingsWithSelf++;
     }
     {
         __dispatch("meet");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
Esempio n. 8
0
 public void meet(Chameneo other, Color color)
 {
     meet(other, color, default(CancellationToken), null, null);
 }
Esempio n. 9
0
 public void request(Chameneo creature)
 {
     request(creature, default(CancellationToken), null, null);
 }