private static void runActions(ContextPool pool, ActionBlock actionBlock, NodesSubstitution substitutions = null, bool useFiltering = true) { if (substitutions != null) { pool.SetSubstitutions(substitutions); } var sortedActions = actionBlock.Actions.OrderByDescending((a) => a.Priority).ToArray(); var hasPushAction = sortedActions.Any(action => action is PushAction); if (hasPushAction) { //start new topic - but only once! (multiple pushes can appear) pool.ClearAccumulator(); } foreach (var action in sortedActions) { action.Run(pool); } if (useFiltering && pool.ActiveCount > 1) { pool.Filter(actionBlock.OutputFilter); } }
internal void SetSubstitutions(NodesSubstitution substitutions) { _substitutions = new Dictionary <NodeReference, NodeReference>(); if (substitutions == null) { //nothing more to substitute return; } for (var nodeIndex = 0; nodeIndex < substitutions.NodeCount; ++nodeIndex) { var key = substitutions.GetOriginalNode(nodeIndex); var substitution = substitutions.GetSubstitution(nodeIndex); _substitutions[key] = substitution; } }
public PoolHypothesis(NodesSubstitution substitutions, MappingControl <ActionBlock> control) { Substitutions = substitutions; ActionBlock = control.Value; Control = control; }