다음을 통해 공유


ElementClosureWalker Class

Definition

Walker that builds closures on Model Elements

public ref class ElementClosureWalker sealed : Microsoft::VisualStudio::Modeling::BreadthFirstRolePlayerFirstElementWalker
public sealed class ElementClosureWalker : Microsoft.VisualStudio.Modeling.BreadthFirstRolePlayerFirstElementWalker
type ElementClosureWalker = class
    inherit BreadthFirstRolePlayerFirstElementWalker
Public NotInheritable Class ElementClosureWalker
Inherits BreadthFirstRolePlayerFirstElementWalker
Inheritance

Constructors

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>, Boolean, IEnumerable<DomainRoleInfo>, Boolean)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>, Boolean, IEnumerable<DomainRoleInfo>, IEnumerable<DomainRoleInfo>, IList<ModelElement>)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>, Boolean, IEnumerable<DomainRoleInfo>, IList<DomainRoleInfo>, Boolean)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>, IEnumerable<DomainRoleInfo>, IList<DomainRoleInfo>)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>, IEnumerable<DomainRoleInfo>)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

ElementClosureWalker(Partition, ClosureType, ICollection<ModelElement>)

Constructor that creates an ElementVisitor and calls base. This results in breadth first traversal, pre-Order visitation of the graph with element links.

Properties

BypassDemandLoading

Allows the walker to bypass demand loading while traversing

(Inherited from ElementWalker)
ClosureList

Resultant List of elements that form the closure

Context

Offer a context object for general use by the closure visitors.
Use it to store tag/value pairs while building closures.

Filter

Get or set the IElementVisitorFilter for use during traversal

(Inherited from ElementWalker)
IncludeLinks

Returns true if the walker will include element links in calls to the visitor function

(Inherited from ElementWalker)
InternalElementList

Get the internal list of elements that will be visited

(Inherited from ElementWalker)
Store

Get the internal list of elements that will be visited

(Inherited from ElementWalker)
Visitor

Get or set the IElementVisitor for use during traversal

(Inherited from ElementWalker)

Methods

DoTraverse(ModelElement)

Traverse the model starting at the specified starting element.

(Inherited from BreadthFirstRolePlayerFirstElementWalker)
MarkForRemovalFromInternalElementList(ModelElement)

Mark an element for removal from the InternalElementList. We mark first and remove later at the end so that the indices remain valid. When marking elements as visited, we store an index in the hashtable which tells us the order that the element was visited in. If the elements were put into the InternalElementList in that order, we can find the element easily using the index. If not a linear search will be used to find the element.

(Inherited from ElementWalker)
MarkVisited(ModelElement)

Mark an element as having been already visited

(Inherited from ElementWalker)
RemoveMarkedElements()

Removes the elements that are marked for removal. Call this at the end of the traversal so that the indices in alreadyVisited remain valid.

(Inherited from ElementWalker)
Reset()

Reset the visitor so that it can start traversing again. This is necessary to clear out the internal list of previously visited elements.

(Inherited from ElementWalker)
ShouldVisitLinkAgain(ElementLink, ModelElement)

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.

(Inherited from ElementWalker)
Traverse(ICollection<ModelElement>)

Traverse the model starting at the specified starting elements.

(Inherited from ElementWalker)
Traverse(ModelElement)

Traverse the model starting at the specified starting element.

(Inherited from ElementWalker)
Visited(ModelElement)

determines if the given element has been visited or not

(Inherited from ElementWalker)

Applies to