org.eclipse.viatra.transformation.runtime.emf.modelmanipulation

## Class AbstractModelManipulations

- java.lang.Object
- - org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.AbstractModelManipulations

- All Implemented Interfaces:
    IModelManipulations
  Direct Known Subclasses:
    ModelManipulationWithEditingDomain, SimpleModelManipulations

      public abstract class AbstractModelManipulations
      extends java.lang.Object
      implements IModelManipulations

  Abstract base class for model manipulation implementation. It checks for the preconditions of the operations, and the subclasses should override the do* methods.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ViatraQueryEngine` | `engine`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractModelManipulations(ViatraQueryEngine engine)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.util.Collection<? extends java.lang.Object> elements)` Adds a collection of existing elements to a selected EStructuralFeature.
    `void` | `add(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element)` Adds an existing element to a selected EStructuralFeature.
    `void` | `add(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element, int index)` Adds an existing element to a selected EStructuralFeature at the specified index.
    `void` | `addTo(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.util.Collection<? extends java.lang.Object> elements)` Adds a collection of existing elements to a selected EStructuralFeature.
    `void` | `addTo(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element)` Adds an existing element to a selected EStructuralFeature.
    `void` | `addTo(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element, int index)` Adds an existing element to a selected EStructuralFeature at the specified index.
    `void` | `changeIndex(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int oldIndex, int newIndex)` Changes the index of an existing element in the selected feature of the selected EObject.
    `org.eclipse.emf.ecore.EObject` | `create(org.eclipse.emf.ecore.resource.Resource res, org.eclipse.emf.ecore.EClass clazz)` Creates an EObject and puts it as the root of the selected resource.
    `org.eclipse.emf.ecore.EObject` | `createChild(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass clazz)` Creates an EObject and puts it into the selected reference of a container.
    `protected abstract void` | `doAdd(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature reference, java.util.Collection<? extends java.lang.Object> element)`
    `protected abstract void` | `doAdd(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature reference, java.lang.Object object, int index)`
    `protected abstract void` | `doChangeIndex(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int oldIndex, int newIndex)`
    `protected abstract org.eclipse.emf.ecore.EObject` | `doCreate(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass clazz)`
    `protected abstract org.eclipse.emf.ecore.EObject` | `doCreate(org.eclipse.emf.ecore.resource.Resource res, org.eclipse.emf.ecore.EClass clazz)`
    `protected void` | `doMoveTo(java.util.Collection<org.eclipse.emf.ecore.EObject> what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference)`
    `protected abstract void` | `doMoveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference)`
    `protected abstract void` | `doMoveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference, int index)`
    `protected abstract void` | `doMoveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.resource.Resource newContainer)`
    `protected abstract void` | `doMoveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.resource.Resource newContainer, int index)`
    `protected abstract void` | `doRemove(org.eclipse.emf.ecore.EObject object)` Removes an element from the containment hierarchy
    `protected abstract void` | `doRemove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature reference)`
    `protected abstract void` | `doRemove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int index)`
    `protected abstract void` | `doRemove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element)` Remove a non-containment reference value
    `protected abstract void` | `doSet(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)`
    `protected NavigationHelper` | `getBaseEMFIndex()`
    `void` | `moveTo(java.util.Collection<org.eclipse.emf.ecore.EObject> what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference)` Moves a collection of existing elements into the selected containment reference of the selected EObject.
    `void` | `moveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference)` Moves an existing element into the selected containment reference of the selected EObject.
    `void` | `moveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.EObject newContainer, org.eclipse.emf.ecore.EReference reference, int index)` Moves an existing element into the selected containment reference of the selected EObject at the specified index.
    `void` | `moveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.resource.Resource newContainer)` Moves an existing element into the root of the selected resource.
    `void` | `moveTo(org.eclipse.emf.ecore.EObject what, org.eclipse.emf.ecore.resource.Resource newContainer, int index)` Moves an existing element into the root of the selected resource at the specified index.
    `void` | `remove(org.eclipse.emf.ecore.EObject object)` Removes an object from the model.
    `void` | `remove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)` Removes all elements from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
    `void` | `remove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int index)` Removes the element at the specified index from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
    `void` | `remove(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object element)` Removes an element from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
    `void` | `set(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)` Sets an element to a selected 'single'-valued EStructuralFeature.

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

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

- - ### Field Detail

    - #### engine

          protected final ViatraQueryEngine engine

  - ### Constructor Detail

    - #### AbstractModelManipulations

          public AbstractModelManipulations(ViatraQueryEngine engine)

  - ### Method Detail

    - #### getBaseEMFIndex

          protected NavigationHelper getBaseEMFIndex()
                                              throws ViatraQueryException

      Throws:
        `ViatraQueryException`

    - #### doMoveTo

          protected void doMoveTo(java.util.Collection<org.eclipse.emf.ecore.EObject> what,
                                  org.eclipse.emf.ecore.EObject newContainer,
                                  org.eclipse.emf.ecore.EReference reference)
                           throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doMoveTo

          protected abstract void doMoveTo(org.eclipse.emf.ecore.EObject what,
                                           org.eclipse.emf.ecore.resource.Resource newContainer)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doMoveTo

          protected abstract void doMoveTo(org.eclipse.emf.ecore.EObject what,
                                           org.eclipse.emf.ecore.resource.Resource newContainer,
                                           int index)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doMoveTo

          protected abstract void doMoveTo(org.eclipse.emf.ecore.EObject what,
                                           org.eclipse.emf.ecore.EObject newContainer,
                                           org.eclipse.emf.ecore.EReference reference)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doMoveTo

          protected abstract void doMoveTo(org.eclipse.emf.ecore.EObject what,
                                           org.eclipse.emf.ecore.EObject newContainer,
                                           org.eclipse.emf.ecore.EReference reference,
                                           int index)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doRemove

          protected abstract void doRemove(org.eclipse.emf.ecore.EObject container,
                                           org.eclipse.emf.ecore.EStructuralFeature feature,
                                           java.lang.Object element)
                                    throws ModelManipulationException

      Remove a non-containment reference value
      Throws:
        `ModelManipulationException`

    - #### doRemove

          protected abstract void doRemove(org.eclipse.emf.ecore.EObject container,
                                           org.eclipse.emf.ecore.EStructuralFeature feature,
                                           int index)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doRemove

          protected abstract void doRemove(org.eclipse.emf.ecore.EObject object)
                                    throws ModelManipulationException

      Removes an element from the containment hierarchy
      Throws:
        `ModelManipulationException`

    - #### doRemove

          protected abstract void doRemove(org.eclipse.emf.ecore.EObject container,
                                           org.eclipse.emf.ecore.EStructuralFeature reference)
                                    throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doAdd

          protected abstract void doAdd(org.eclipse.emf.ecore.EObject container,
                                        org.eclipse.emf.ecore.EStructuralFeature reference,
                                        java.util.Collection<? extends java.lang.Object> element)
                                 throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doAdd

          protected abstract void doAdd(org.eclipse.emf.ecore.EObject container,
                                        org.eclipse.emf.ecore.EStructuralFeature reference,
                                        java.lang.Object object,
                                        int index)
                                 throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doSet

          protected abstract void doSet(org.eclipse.emf.ecore.EObject container,
                                        org.eclipse.emf.ecore.EStructuralFeature feature,
                                        java.lang.Object value)
                                 throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doCreate

          protected abstract org.eclipse.emf.ecore.EObject doCreate(org.eclipse.emf.ecore.EObject container,
                                                                    org.eclipse.emf.ecore.EReference reference,
                                                                    org.eclipse.emf.ecore.EClass clazz)
                                                             throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doCreate

          protected abstract org.eclipse.emf.ecore.EObject doCreate(org.eclipse.emf.ecore.resource.Resource res,
                                                                    org.eclipse.emf.ecore.EClass clazz)
                                                             throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### doChangeIndex

          protected abstract void doChangeIndex(org.eclipse.emf.ecore.EObject container,
                                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                                int oldIndex,
                                                int newIndex)
                                         throws ModelManipulationException

      Throws:
        `ModelManipulationException`

    - #### create

          public org.eclipse.emf.ecore.EObject create(org.eclipse.emf.ecore.resource.Resource res,
                                                      org.eclipse.emf.ecore.EClass clazz)
                                               throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Creates an EObject and puts it as the root of the selected resource.
      Specified by:
        `create` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### createChild

          public org.eclipse.emf.ecore.EObject createChild(org.eclipse.emf.ecore.EObject container,
                                                           org.eclipse.emf.ecore.EReference reference,
                                                           org.eclipse.emf.ecore.EClass clazz)
                                                    throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Creates an EObject and puts it into the selected reference of a container. The container reference must be a containment reference.
      Specified by:
        `createChild` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### add

          public void add(org.eclipse.emf.ecore.EObject container,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          java.lang.Object element)
                   throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds an existing element to a selected EStructuralFeature. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `add` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### addTo

          public void addTo(org.eclipse.emf.ecore.EObject container,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.Object element)
                     throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds an existing element to a selected EStructuralFeature. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `addTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### add

          public void add(org.eclipse.emf.ecore.EObject container,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          java.lang.Object element,
                          int index)
                   throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds an existing element to a selected EStructuralFeature at the specified index. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `add` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### add

          public void add(org.eclipse.emf.ecore.EObject container,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          java.util.Collection<? extends java.lang.Object> elements)
                   throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds a collection of existing elements to a selected EStructuralFeature. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `add` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### addTo

          public void addTo(org.eclipse.emf.ecore.EObject container,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.Object element,
                            int index)
                     throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds an existing element to a selected EStructuralFeature at the specified index. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `addTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### addTo

          public void addTo(org.eclipse.emf.ecore.EObject container,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.util.Collection<? extends java.lang.Object> elements)
                     throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Adds a collection of existing elements to a selected EStructuralFeature. If the feature is an EReference, it must not be a containment reference.
      Specified by:
        `addTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### set

          public void set(org.eclipse.emf.ecore.EObject container,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          java.lang.Object value)
                   throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Sets an element to a selected 'single'-valued EStructuralFeature.
      Specified by:
        `set` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### remove

          public void remove(org.eclipse.emf.ecore.EObject object)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Removes an object from the model.
      Specified by:
        `remove` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### remove

          public void remove(org.eclipse.emf.ecore.EObject container,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             java.lang.Object element)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Removes an element from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
      Specified by:
        `remove` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### remove

          public void remove(org.eclipse.emf.ecore.EObject container,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             int index)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Removes the element at the specified index from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
      Specified by:
        `remove` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### remove

          public void remove(org.eclipse.emf.ecore.EObject container,
                             org.eclipse.emf.ecore.EStructuralFeature feature)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Removes all elements from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well.
      Specified by:
        `remove` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### moveTo

          public void moveTo(org.eclipse.emf.ecore.EObject what,
                             org.eclipse.emf.ecore.resource.Resource newContainer)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Moves an existing element into the root of the selected resource.
      Specified by:
        `moveTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### moveTo

          public void moveTo(org.eclipse.emf.ecore.EObject what,
                             org.eclipse.emf.ecore.resource.Resource newContainer,
                             int index)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Moves an existing element into the root of the selected resource at the specified index.
      Specified by:
        `moveTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### moveTo

          public void moveTo(org.eclipse.emf.ecore.EObject what,
                             org.eclipse.emf.ecore.EObject newContainer,
                             org.eclipse.emf.ecore.EReference reference)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Moves an existing element into the selected containment reference of the selected EObject.
      Specified by:
        `moveTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### moveTo

          public void moveTo(org.eclipse.emf.ecore.EObject what,
                             org.eclipse.emf.ecore.EObject newContainer,
                             org.eclipse.emf.ecore.EReference reference,
                             int index)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Moves an existing element into the selected containment reference of the selected EObject at the specified index.
      Specified by:
        `moveTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### moveTo

          public void moveTo(java.util.Collection<org.eclipse.emf.ecore.EObject> what,
                             org.eclipse.emf.ecore.EObject newContainer,
                             org.eclipse.emf.ecore.EReference reference)
                      throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Moves a collection of existing elements into the selected containment reference of the selected EObject.
      Specified by:
        `moveTo` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`

    - #### changeIndex

          public void changeIndex(org.eclipse.emf.ecore.EObject container,
                                  org.eclipse.emf.ecore.EStructuralFeature feature,
                                  int oldIndex,
                                  int newIndex)
                           throws ModelManipulationException

      Description copied from interface: `IModelManipulations`
      Changes the index of an existing element in the selected feature of the selected EObject.
      Specified by:
        `changeIndex` in interface `IModelManipulations`
      Throws:
        `ModelManipulationException`