public void TraverseWithFunctionUseSpecificBehavior(IPreTraverseEvaluator preTraverseEvaluator, IPostTraverseEvaluator postTraverseEvaluator) { _referenceTraverseID++; _traverseOptions = preTraverseEvaluator is Invalidator || postTraverseEvaluator is Invalidator ? TraverseOption.UseInvalidationMarks : TraverseOption.None; TraverseWithFunctionUseSpecificBehaviorInternal(preTraverseEvaluator, postTraverseEvaluator); }
private void TraverseWithFunctionUseSpecificBehaviorInternal(IPreTraverseEvaluator preTraverseEvaluator, IPostTraverseEvaluator postTraverseEvaluator) { if ((_traverseOptions.HasFlag(TraverseOption.UseInvalidationMarks) && HasValidInvalidationMarksOnOperatorPartsForTraversing && !SubTreeContainsInvalidatable) || _traverseID == _referenceTraverseID) { if (postTraverseEvaluator != null) { postTraverseEvaluator.AlreadyVisited(this); } return; } _traverseID = _referenceTraverseID; if (preTraverseEvaluator != null) { preTraverseEvaluator.PreEvaluate(this); } IEnumerable <OperatorPart> connections; ITraverseModifier traversModifier = Func as ITraverseModifier; if (traversModifier != null) { connections = traversModifier.GetRelevantConnections(); } else { connections = Connections; } foreach (var opPart in connections) { if (postTraverseEvaluator != null) { postTraverseEvaluator.ChildrenStart(); } opPart.TraverseWithFunctionUseSpecificBehaviorInternal(preTraverseEvaluator, postTraverseEvaluator); if (postTraverseEvaluator != null) { postTraverseEvaluator.ChildrenEnd(); } } if (postTraverseEvaluator != null) { postTraverseEvaluator.PostEvaluate(this); } }
private void TraverseWithFunctionInternal(IPreTraverseEvaluator preTraverseEvaluator, IPostTraverseEvaluator postTraverseEvaluator) { if ((_traverseOptions.HasFlag(TraverseOption.UseInvalidationMarks) && HasValidInvalidationMarksOnOperatorPartsForTraversing && !SubTreeContainsInvalidatable) || _traverseID == _referenceTraverseID) { if (postTraverseEvaluator != null) { postTraverseEvaluator.AlreadyVisited(this); } return; } _traverseID = _referenceTraverseID; if (preTraverseEvaluator != null) { preTraverseEvaluator.PreEvaluate(this); } foreach (var input in Connections) { if (postTraverseEvaluator != null) { postTraverseEvaluator.ChildrenStart(); } if (!input.Disabled) { input.TraverseWithFunctionInternal(preTraverseEvaluator, postTraverseEvaluator); } if (postTraverseEvaluator != null) { postTraverseEvaluator.ChildrenEnd(); } } if (postTraverseEvaluator != null) { postTraverseEvaluator.PostEvaluate(this); } }