Class AbstractModelManipulations

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      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 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 changeIndex​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int oldIndex, int newIndex)
      Changes the position of an existing element in the selected feature of the selected model object.
      int count​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)
      Retrieves the number of values in a given feature slot of a given container model element.
      org.eclipse.emf.ecore.EObject create​(org.eclipse.emf.ecore.resource.Resource res, org.eclipse.emf.ecore.EClass clazz)
      Creates a model object and puts it as the root of the selected root container.
      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 a model object 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.lang.Object object, int index)  
      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 doChangeIndex​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, int oldIndex, int newIndex)  
      protected abstract int doCount​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)  
      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 abstract boolean doIsSetTo​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)  
      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 abstract java.util.stream.Stream<? extends java.lang.Object> doStream​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)  
      org.eclipse.emf.ecore.EClass eClass​(org.eclipse.emf.ecore.EObject element)
      Queries the exact type of the given object.
      protected NavigationHelper getBaseEMFIndex()  
      protected static java.util.Collection<java.lang.Object> getSlotValuesInternal​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)  
      boolean isSetTo​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Returns whether the given value is listed among the values in a given feature slot of a given container model element.
      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 model object.
      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 model object.
      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 model object 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 root container.
      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 root container at the specified index.
      void remove​(org.eclipse.emf.ecore.EObject object)
      Removes an object from the model, along with all contained objects, and any incoming or outgoing references.
      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 (it is assumed that no dangling cross-references point to it).
      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 (it is assumed that no dangling cross-references point to it).
      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 (it is assumed that no dangling cross-references point to it).
      void set​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
      Sets a 'single'-valued EStructuralFeature of a given container model element to the given value.
      java.util.stream.Stream<? extends java.lang.Object> stream​(org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EStructuralFeature feature)
      Retrieves all values in a given feature slot of a given container model element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractModelManipulations

        public AbstractModelManipulations​(ViatraQueryEngine engine)
    • Method Detail

      • 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
      • 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
      • 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
      • doStream

        protected abstract java.util.stream.Stream<? extends java.lang.Object> doStream​(org.eclipse.emf.ecore.EObject container,
                                                                                        org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                                 throws ModelManipulationException
        Throws:
        ModelManipulationException
        Since:
        2.1
      • stream

        public java.util.stream.Stream<? extends java.lang.Object> stream​(org.eclipse.emf.ecore.EObject container,
                                                                          org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                   throws ModelManipulationException
        Description copied from interface: IEcoreReadOperations
        Retrieves all values in a given feature slot of a given container model element.
        Specified by:
        stream in interface IEcoreReadOperations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        Throws:
        ModelManipulationException
        Since:
        2.1
      • isSetTo

        public boolean isSetTo​(org.eclipse.emf.ecore.EObject container,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               java.lang.Object value)
                        throws ModelManipulationException
        Description copied from interface: IEcoreReadOperations
        Returns whether the given value is listed among the values in a given feature slot of a given container model element.
        Specified by:
        isSetTo in interface IEcoreReadOperations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        Throws:
        ModelManipulationException
        Since:
        2.1
      • 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: IEcoreManipulations
        Creates a model object and puts it into the selected reference of a container. The container reference must be a containment reference.
        Specified by:
        createChild in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        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 IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        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 IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        Sets a 'single'-valued EStructuralFeature of a given container model element to the given value.

        The previous value of the feature, if any, is removed. If the provided new value is null, then the invocation acts as 'unset', and no new value is stored.

        Specified by:
        set in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        value - the new value to be set, or null

        TODO restrict to non-containment?

        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: IEcoreManipulations
        Removes an element from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well (it is assumed that no dangling cross-references point to it).
        Specified by:
        remove in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        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 (it is assumed that no dangling cross-references point to it).
        Specified by:
        remove in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        Throws:
        ModelManipulationException
      • remove

        public void remove​(org.eclipse.emf.ecore.EObject container,
                           org.eclipse.emf.ecore.EStructuralFeature feature)
                    throws ModelManipulationException
        Description copied from interface: IEcoreManipulations
        Removes all elements from the 'many'-valued reference; if the reference is a containment reference, the element is removed from the model as well (it is assumed that no dangling cross-references point to it).
        Specified by:
        remove in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        Moves an existing element into the root of the selected root container at the specified index.
        Specified by:
        moveTo in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        Moves an existing element into the selected containment reference of the selected model object.
        Specified by:
        moveTo in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        Moves an existing element into the selected containment reference of the selected model object at the specified index.
        Specified by:
        moveTo in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        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: IEcoreManipulations
        Changes the position of an existing element in the selected feature of the selected model object.
        Specified by:
        changeIndex in interface IEcoreManipulations<org.eclipse.emf.ecore.resource.Resource,​org.eclipse.emf.ecore.EObject>
        Throws:
        ModelManipulationException
      • getSlotValuesInternal

        protected static java.util.Collection<java.lang.Object> getSlotValuesInternal​(org.eclipse.emf.ecore.EObject container,
                                                                                      org.eclipse.emf.ecore.EStructuralFeature feature)
        Since:
        2.1