protected override void HandleReadyComputation(Computation computation)
            {
                var syncComputation = (SynchronizationComputation <TLeft, TRight>)computation;
                var left            = syncComputation.Input;
                var right           = syncComputation.Opposite.Input;

                switch (syncComputation.SynchronizationContext.ChangePropagation)
                {
                case ChangePropagationMode.None:
                    if (guard.Evaluate(left, right))
                    {
                        parent.CreateLeftToRightSynchronization(syncComputation);
                    }
                    break;

                case ChangePropagationMode.OneWay:
                case ChangePropagationMode.TwoWay:
                    var tracker = guard.Observe(left, right);
                    syncComputation.Dependencies.Add(new GuardedSynchronization <TLeft, TRight>(syncComputation, parent.CreateLeftToRightSynchronization, tracker));
                    break;

                default:
                    break;
                }
            }
            protected override void HandleReadyComputation(Computation computation)
            {
                var syncComputation = (SynchronizationComputation <TRight, TLeft>)computation;
                var right           = syncComputation.Input;

                switch (syncComputation.SynchronizationContext.ChangePropagation)
                {
                case ChangePropagationMode.None:
                    if (guard.Evaluate(right))
                    {
                        parent.CreateRightToLeftOnlySynchronization(syncComputation);
                    }
                    break;

                case ChangePropagationMode.OneWay:
                case ChangePropagationMode.TwoWay:
                    var tracker = guard.Observe(right);
                    tracker.Successors.SetDummy();
                    syncComputation.Dependencies.Add(new GuardedSynchronization <TRight, TLeft>(syncComputation, parent.CreateRightToLeftOnlySynchronization, tracker));
                    break;

                default:
                    break;
                }
            }
Esempio n. 3
0
 private void PerformLookup()
 {
     foreach (var item in source)
     {
         var key    = keySelector.Evaluate(item);
         var lookup = GetOrCreateLookup(key);
         lookup.Items.Add(item);
     }
 }
Esempio n. 4
0
        private bool ReplaceItem(TItem old, TItem newItem)
        {
            var oldKey = keys[old];
            var newKey = keySelector.Evaluate(newItem);

            if (EqualityComparer <TKey> .Default.Equals(oldKey.Value, newKey))
            {
                var group   = groups[newKey];
                int itemIdx = group.Items.IndexOf(old);
                group.Items[itemIdx] = newItem;
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
 public static int Fac(int n)
 {
     return(fac.Evaluate(n));
 }
Esempio n. 6
0
        public static ObservingFunc <T, U> Y <T, U>(ObservingFunc <ObservingFunc <T, U>, ObservingFunc <T, U> > f)
        {
            ObservingFunc <Wrap <ObservingFunc <T, U> >, ObservingFunc <T, U> > g = new ObservingFunc <Wrap <ObservingFunc <T, U> >, ObservingFunc <T, U> >(wx => f.Evaluate(wx.It.Evaluate(wx)));

            return(g.Evaluate(new Wrap <ObservingFunc <T, U> >(new ObservingFunc <Wrap <ObservingFunc <T, U> >, ObservingFunc <T, U> >(wx => f.Evaluate(new ObservingFunc <T, U>(y => wx.It.Evaluate(wx).Evaluate(y)))))));
        }
Esempio n. 7
0
 public static Color TraceRay(TraceRayArgs rayArgs)
 {
     return(_traceRay.Evaluate(rayArgs));
 }
Esempio n. 8
0
 public void Recursive_Factorial_Evaluate()
 {
     Assert.AreEqual(1, fac.Evaluate(0));
     Assert.AreEqual(1, fac.Evaluate(1));
     Assert.AreEqual(24, fac.Evaluate(4));
 }
 public static string GetFullName(this IFamilyMember member)
 {
     return(fullName.Evaluate(member));
 }