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

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<ESDeleteObjectMutation>
              extended by org.eclipse.emf.emfstore.internal.modelmutator.mutation.DeleteObjectMutation
All Implemented Interfaces:
Cloneable, ESContainmentChangeMutation<ESDeleteObjectMutation>, ESDeleteObjectMutation, ESMutation, ESStructuralFeatureMutation<ESDeleteObjectMutation>

public class DeleteObjectMutation
extends ContainmentChangeMutation<ESDeleteObjectMutation>
implements ESDeleteObjectMutation

A mutation, which deletes a new object from the model.

Author:
Philip Langer

Constructor Summary
DeleteObjectMutation(ESModelMutatorUtil util)
          Creates a new mutation with the specified util.
DeleteObjectMutation(ESModelMutatorUtil util, MutationTargetSelector selector)
          Creates a new mutation with the specified util and the selector.
 
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 getEObjectToDelete()
          Returns the object deleted or to be deleted by this mutation.
 int getMaxNumberOfContainments()
          Returns the maximum number of containments that the object selected for deletion may contain.
 void setEObjectToDelete(org.eclipse.emf.ecore.EObject eObjectToDelete)
          Sets the object to be deleted by this mutation.
 DeleteObjectMutation setMaxNumberOfContainments(int maxNumberOfContainments)
          Sets the maximum number of containments that the object selected for deletion may contain.
 
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

DeleteObjectMutation

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

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

DeleteObjectMutation

public DeleteObjectMutation(ESModelMutatorUtil util,
                            MutationTargetSelector selector)
Creates a new mutation with the specified util and the selector.

Parameters:
util - The model mutator util used for accessing the model to be mutated.
selector - The target selector for selecting the target container and feature.
Method Detail

setMaxNumberOfContainments

public DeleteObjectMutation setMaxNumberOfContainments(int maxNumberOfContainments)
Sets the maximum number of containments that the object selected for deletion may contain.

Specified by:
setMaxNumberOfContainments in interface ESDeleteObjectMutation
Parameters:
maxNumberOfContainments - the maximum number of containments of the object to be deleted.
Returns:
this mutation
See Also:
ESDeleteObjectMutation.setMaxNumberOfContainments(int)

getMaxNumberOfContainments

public int getMaxNumberOfContainments()
Returns the maximum number of containments that the object selected for deletion may contain.

Returns:
The maximum number of containments of the object to be deleted.

setEObjectToDelete

public void setEObjectToDelete(org.eclipse.emf.ecore.EObject eObjectToDelete)
Sets the object to be deleted by this mutation.

Parameters:
eObjectToDelete - The object to be deleted.

getEObjectToDelete

public org.eclipse.emf.ecore.EObject getEObjectToDelete()
Returns the object deleted or to be deleted by this mutation.

Returns:
The deleted or to-be-deleted object.

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.