public void InitializeOutput(object output) { if (OutputDelay != null) { OutputDelay.ExecutePersistors(output); } OutputDelay = null; }
/// <summary> /// Delays the ouput of this computation with the given output delay /// </summary> /// <param name="delay"></param> internal void DelayOutput(OutputDelay delay) { if (delay == null) { throw new ArgumentNullException("delay"); } if (OutputDelay != null) { delay.Persistors.AddRange(OutputDelay.Persistors); } OutputDelay = delay; }
private void HandleDelayedComputation(Computation computation, ITransformationContext context, OutputDelay delay) { var inCollection = Selector(computation); if (inCollection != null) { if (Persistor != null) { Type listType = (typeof(List <>)).MakeGenericType(DependencyTransformation.OutputType); IList list = System.Activator.CreateInstance(listType) as IList; MultipleResultAwaitingPersistor delayPersistor = new MultipleResultAwaitingPersistor() { List = list, Persistor = Persistor }; if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { HandleDelayedDependencyInput(computation, context, list, delayPersistor, dependencyInput); }); } else { foreach (var dependencyInput in inCollection) { HandleDelayedDependencyInput(computation, context, list, delayPersistor, dependencyInput); } } delay.Persistors.Add(delayPersistor); } else { if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { GeneralTransformationRule dependent = DependencyTransformation; var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); }); } else { foreach (var dependencyInput in inCollection) { GeneralTransformationRule dependent = DependencyTransformation; var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); } } } } }
/// <summary> /// Delays the ouput of this computation with the given output delay /// </summary> /// <param name="delay"></param> internal void DelayOutput(OutputDelay delay) { if (delay == null) throw new ArgumentNullException("delay"); if (OutputDelay != null) { delay.Persistors.AddRange(OutputDelay.Persistors); } OutputDelay = delay; }
internal static void DelayOutput(this Computation computation, OutputDelay outputDelay) { var cc = computation.Context as ComputationContext; cc.DelayOutput(outputDelay); }
private void HandleDelayedComputation(Computation computation, ITransformationContext context, OutputDelay delay) { var inCollection = Selector(computation); if (inCollection != null) { if (Persistor != null) { Type listType = (typeof(List<>)).MakeGenericType(DependencyTransformation.OutputType); IList list = System.Activator.CreateInstance(listType) as IList; MultipleResultAwaitingPersistor delayPersistor = new MultipleResultAwaitingPersistor() { List = list, Persistor = Persistor }; if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { HandleDelayedDependencyInput(computation, context, list, delayPersistor, dependencyInput); }); } else { foreach (var dependencyInput in inCollection) { HandleDelayedDependencyInput(computation, context, list, delayPersistor, dependencyInput); } } delay.Persistors.Add(delayPersistor); } else { if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { GeneralTransformationRule dependent = DependencyTransformation; var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); }); } else { foreach (var dependencyInput in inCollection) { GeneralTransformationRule dependent = DependencyTransformation; var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); } } } } }