Freigeben über


ElementWalker.ShouldVisitLinkAgain(ElementLink, ModelElement) Method

Definition

When looking at the related elements of the given currentElement, if we find a link that has been enqueued for visiting, this function will tell you if it needs to be visited again. This is if the link has been visited before the currentElement (one of its roleplayers) was visited.

For closure walkers, we guarantee that the link will be visited only after the roleplayers are visited (technically, we guarantee that the InternalElementList will contain the link after the roleplayers). Consider this scenario: We have element A that is a roleplayer for 2 relationships AHasBs and CHasAs. During the closure traversal, A is first approached from B through AHasBs. However, it does not have prop-delete on it, so it is not visited but the AHasBs is visited. Later in the traversal, A is approached from C via CHasAs. This time, A is visited because it has prop-delete. Now we get a case where AHasBs was visited before one of its roleplayers (A) was visited. To fix this, if the walkers find that a link has been visited (or rather, been enqueued for visiting) , it should check if it should be visited again (check if it was already visited before currentElement). If so, it should remove the link from the InternalElementList using the methods MarkForRemovalFromInternalElementList and RemoveMarkedElements, and add it to the queue to be visited again.

protected:
 bool ShouldVisitLinkAgain(Microsoft::VisualStudio::Modeling::ElementLink ^ link, Microsoft::VisualStudio::Modeling::ModelElement ^ currentElement);
protected bool ShouldVisitLinkAgain (Microsoft.VisualStudio.Modeling.ElementLink link, Microsoft.VisualStudio.Modeling.ModelElement currentElement);
member this.ShouldVisitLinkAgain : Microsoft.VisualStudio.Modeling.ElementLink * Microsoft.VisualStudio.Modeling.ModelElement -> bool
Protected Function ShouldVisitLinkAgain (link As ElementLink, currentElement As ModelElement) As Boolean

Parameters

link
ElementLink

The link that was found to be already enqueued for visiting

currentElement
ModelElement

The current element whose related elements we are visiting

Returns

Applies to