org.eclipse.emf.emfstore.internal.modelmutator.mutation
Class MoveObjectMutation

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.modelmutator.mutation.Mutation
      extended by org.eclipse.emf.emfstore.internal.modelmutator.mutation.StructuralFeatureMutation<M>
          extended by org.eclipse.emf.emfstore.internal.modelmutator.mutation.ContainmentChangeMutation<ESMoveObjectMutation>
              extended by org.eclipse.emf.emfstore.internal.modelmutator.mutation.MoveObjectMutation
All Implemented Interfaces:
Cloneable, ESContainmentChangeMutation<ESMoveObjectMutation>, ESMoveObjectMutation, ESMutation, ESStructuralFeatureMutation<ESMoveObjectMutation>

public class MoveObjectMutation
extends ContainmentChangeMutation<ESMoveObjectMutation>
implements ESMoveObjectMutation

A mutation, which moves an object from one container into another.

Author:
Philip Langer

Constructor Summary
MoveObjectMutation(ESModelMutatorUtil util)
          Creates a new mutation with the specified util.
 
Method Summary
 void apply()
          Applies this mutation and returns whether it succeeded in being applied.
 Mutation clone()
          Mutations must follow the prototype pattern as org.eclipse.emf.emfstore.internal.modelmutator.api.ModelMutator will clone pre-configured mutations before they will be completed and applied.
 org.eclipse.emf.ecore.EObject getEObjectToMove()
          Returns the EObject that will be or has been moved.
 Collection<org.eclipse.emf.ecore.EClass> getExcludedSourceEClasses()
          Returns the collection of EClasses to be excluded when selecting the source object from which this mutation will move an object.
 Collection<org.eclipse.emf.ecore.EStructuralFeature> getExcludedSourceFeatures()
          Returns the collection of features to be excluded from being selected as the source object's containment feature from which this mutation will move an object.
 Collection<org.eclipse.emf.ecore.EObject> getExcludedSourceObjects()
          Returns the collection of EObjects to be excluded from being selected as the source object from which this mutation will move an object.
 org.eclipse.emf.ecore.EStructuralFeature getSourceFeature()
          Returns the EStructuralFeature of a source object from which this mutation will move or moved an object.
 org.eclipse.emf.ecore.EObject getSourceObject()
          Returns the selected or set source object from which this mutation will move or moved an object.
 ESMoveObjectMutation setEObjectToMove(org.eclipse.emf.ecore.EObject eObjectToMove)
          Sets the EObject to be moved.
 ESMoveObjectMutation setSourceFeature(org.eclipse.emf.ecore.EStructuralFeature sourceFeature)
          Sets the EStructuralFeature of a source object from which this mutation will move or moved an object.
 ESMoveObjectMutation setSourceObject(org.eclipse.emf.ecore.EObject sourceObject)
          Sets the EObject to be used as source object from which this mutation will move an object.
 
Methods inherited from class org.eclipse.emf.emfstore.internal.modelmutator.mutation.StructuralFeatureMutation
getExcludedTargetEClasses, getExcludedTargetFeatures, getExcludedTargetObjects, getTargetFeature, getTargetObject, setTargetFeature, setTargetObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.emfstore.modelmutator.ESStructuralFeatureMutation
getExcludedTargetEClasses, getExcludedTargetFeatures, getExcludedTargetObjects, getTargetFeature, getTargetObject, setTargetFeature, setTargetObject
 

Constructor Detail

MoveObjectMutation

public MoveObjectMutation(ESModelMutatorUtil util)
Creates a new mutation with the specified util.

Parameters:
util - The model mutator util used for accessing the model to be mutated.
Method Detail

getExcludedSourceEClasses

public Collection<org.eclipse.emf.ecore.EClass> getExcludedSourceEClasses()
Returns the collection of EClasses to be excluded when selecting the source object from which this mutation will move an object.

That is, EObjects are excluded from being selected as source object if they are an instance of an EClass contained in this collection. The returned collection is changeable. Add items using getExcludedSourceEClasses().add.

Returns:
The collection of excluded EClasses.

getExcludedSourceFeatures

public Collection<org.eclipse.emf.ecore.EStructuralFeature> getExcludedSourceFeatures()
Returns the collection of features to be excluded from being selected as the source object's containment feature from which this mutation will move an object.

The returned collection is changeable. Add items using getExcludedSourceFeatures().add.

Returns:
The collection of excluded features.

getExcludedSourceObjects

public Collection<org.eclipse.emf.ecore.EObject> getExcludedSourceObjects()
Returns the collection of EObjects to be excluded from being selected as the source object from which this mutation will move an object.

The returned collection is changeable. Add items using getExcludedSourceObjects().add.

Returns:
The collection of EObjects.

setSourceObject

public ESMoveObjectMutation setSourceObject(org.eclipse.emf.ecore.EObject sourceObject)
Sets the EObject to be used as source object from which this mutation will move an object.

Specified by:
setSourceObject in interface ESMoveObjectMutation
Parameters:
sourceObject - the source object to be moved from.
Returns:
this mutation
See Also:
ESMoveObjectMutation.setSourceObject(org.eclipse.emf.ecore.EObject)

getSourceObject

public org.eclipse.emf.ecore.EObject getSourceObject()
Returns the selected or set source object from which this mutation will move or moved an object.

Specified by:
getSourceObject in interface ESMoveObjectMutation
Returns:
the source object of the moved or to-be-moved object
See Also:
ESMoveObjectMutation.getSourceObject()

setSourceFeature

public ESMoveObjectMutation setSourceFeature(org.eclipse.emf.ecore.EStructuralFeature sourceFeature)
Sets the EStructuralFeature of a source object from which this mutation will move or moved an object.

Specified by:
setSourceFeature in interface ESMoveObjectMutation
Parameters:
sourceFeature - The feature of the source object through which the moved or to-be-moved object was or is contained.
Returns:
this mutation
See Also:
ESMoveObjectMutation.setSourceFeature(org.eclipse.emf.ecore.EStructuralFeature)

getSourceFeature

public org.eclipse.emf.ecore.EStructuralFeature getSourceFeature()
Returns the EStructuralFeature of a source object from which this mutation will move or moved an object.

Returns:
The feature of the source object through which the moved or to-be-moved object was or is contained.

setEObjectToMove

public ESMoveObjectMutation setEObjectToMove(org.eclipse.emf.ecore.EObject eObjectToMove)
Sets the EObject to be moved.

Specified by:
setEObjectToMove in interface ESMoveObjectMutation
Parameters:
eObjectToMove - the object to be moved
Returns:
this mutation
See Also:
ESMoveObjectMutation.setEObjectToMove(org.eclipse.emf.ecore.EObject)

getEObjectToMove

public org.eclipse.emf.ecore.EObject getEObjectToMove()
Returns the EObject that will be or has been moved.

Specified by:
getEObjectToMove in interface ESMoveObjectMutation
Returns:
the moved or to-be-moved object
See Also:
ESMoveObjectMutation.getEObjectToMove()

clone

public Mutation clone()
Mutations must follow the prototype pattern as org.eclipse.emf.emfstore.internal.modelmutator.api.ModelMutator will clone pre-configured mutations before they will be completed and applied. This allows clients to provide a specifically configured set mutations and start the mutation only from cloning and applying the set of pre-configured mutations.

Specified by:
clone in class Mutation
Returns:
A copy of this mutation with the same configuration.
See Also:
Mutation.clone()

apply

public void apply()
           throws ESMutationException
Applies this mutation and returns whether it succeeded in being applied.

Specified by:
apply in interface ESMutation
Specified by:
apply in class Mutation
Throws:
ESMutationException - thrown if the mutation failed.
See Also:
Mutation.apply()


Copyright © 2015. All Rights Reserved.