org.eclipse.viatra.query.runtime.base.comprehension

## Class EMFVisitor

- java.lang.Object
- - org.eclipse.viatra.query.runtime.base.comprehension.EMFVisitor

- Direct Known Subclasses:
    DerivedFeatureAdapter.DerivedFeatureEMFVisitor

      public class EMFVisitor
      extends java.lang.Object

  Use EMFModelComprehension to visit an EMF model.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EMFVisitor(boolean preOrder)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `attemptProxyResolutions(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference feature)` Whether the given reference of the given object should be resolved when it is a proxy
    `boolean` | `avoidTransientContainmentLink(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject targetObject)` An opportunity for the visitor to indicate that the containment link is considered in a transient state, and the model comprehension should avoid following it.
    `boolean` | `descendAlongCrossResourceContainments()`
    `boolean` | `preOrder()`
    `boolean` | `pruneFeature(org.eclipse.emf.ecore.EStructuralFeature feature)` Returns true if the given feature should not be traversed (interesting esp.
    `boolean` | `pruneSubtrees(org.eclipse.emf.ecore.EObject source)` Returns true if the contents of an object should be pruned (and not explored by the visitor)
    `boolean` | `pruneSubtrees(org.eclipse.emf.ecore.resource.Resource source)` Returns true if the contents of a resource should be pruned (and not explored by the visitor)
    `void` | `visitAttribute(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EAttribute feature, java.lang.Object target)`
    `void` | `visitElement(org.eclipse.emf.ecore.EObject source)`
    `void` | `visitInternalContainment(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference feature, org.eclipse.emf.ecore.EObject target)`
    `void` | `visitNonContainmentReference(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference feature, org.eclipse.emf.ecore.EObject target)`
    `void` | `visitProxyReference(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject targetObject, java.lang.Integer position)` Called after visiting the reference, if the target is a proxy.
    `void` | `visitResource(org.eclipse.emf.ecore.resource.Resource resource)`
    `void` | `visitTopElementInResource(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.EObject element)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EMFVisitor

          public EMFVisitor(boolean preOrder)

  - ### Method Detail

    - #### visitTopElementInResource

          public void visitTopElementInResource(org.eclipse.emf.ecore.resource.Resource resource,
                                                org.eclipse.emf.ecore.EObject element)

      Parameters:
        `resource` -
        `element` -

    - #### visitResource

          public void visitResource(org.eclipse.emf.ecore.resource.Resource resource)

      Parameters:
        `resource` -

    - #### visitElement

          public void visitElement(org.eclipse.emf.ecore.EObject source)

      Parameters:
        `source` -

    - #### visitNonContainmentReference

          public void visitNonContainmentReference(org.eclipse.emf.ecore.EObject source,
                                                   org.eclipse.emf.ecore.EReference feature,
                                                   org.eclipse.emf.ecore.EObject target)

      Parameters:
        `source` -
        `feature` -
        `target` -

    - #### visitInternalContainment

          public void visitInternalContainment(org.eclipse.emf.ecore.EObject source,
                                               org.eclipse.emf.ecore.EReference feature,
                                               org.eclipse.emf.ecore.EObject target)

      Parameters:
        `source` -
        `feature` -
        `target` -

    - #### visitAttribute

          public void visitAttribute(org.eclipse.emf.ecore.EObject source,
                                     org.eclipse.emf.ecore.EAttribute feature,
                                     java.lang.Object target)

      Parameters:
        `source` -
        `feature` -
        `target` -

    - #### pruneFeature

          public boolean pruneFeature(org.eclipse.emf.ecore.EStructuralFeature feature)

      Returns true if the given feature should not be traversed (interesting esp. if multi-valued)

    - #### pruneSubtrees

          public boolean pruneSubtrees(org.eclipse.emf.ecore.EObject source)

      Returns true if the contents of an object should be pruned (and not explored by the visitor)

    - #### pruneSubtrees

          public boolean pruneSubtrees(org.eclipse.emf.ecore.resource.Resource source)

      Returns true if the contents of a resource should be pruned (and not explored by the visitor)

    - #### avoidTransientContainmentLink

          public boolean avoidTransientContainmentLink(org.eclipse.emf.ecore.EObject source,
                                                       org.eclipse.emf.ecore.EReference reference,
                                                       org.eclipse.emf.ecore.EObject targetObject)

      An opportunity for the visitor to indicate that the containment link is considered in a transient state, and the model comprehension should avoid following it. A containment is in a transient state from the point of view of the visitor if it connects a subtree that is being inserted during a full-model traversal, and a separate notification handler will deal with it later.

    - #### preOrder

          public boolean preOrder()

      Returns:
        if objects should be visited before their outgoing edges

    - #### visitProxyReference

          public void visitProxyReference(org.eclipse.emf.ecore.EObject source,
                                          org.eclipse.emf.ecore.EReference reference,
                                          org.eclipse.emf.ecore.EObject targetObject,
                                          java.lang.Integer position)

      Called after visiting the reference, if the target is a proxy.
      Parameters:
        `position` - optional: known position in multivalued collection (for more efficient proxy resolution)

    - #### attemptProxyResolutions

          public boolean attemptProxyResolutions(org.eclipse.emf.ecore.EObject source,
                                                 org.eclipse.emf.ecore.EReference feature)

      Whether the given reference of the given object should be resolved when it is a proxy

    - #### descendAlongCrossResourceContainments

          public boolean descendAlongCrossResourceContainments()

      Returns:
        true if traversing visitors shall descend along cross-resource containments (this only makes sense for traversing visitors on an object scope)
      Since:
        1.7