Class Modification
java.lang.Object
com.amalgamasimulation.studies.core.Modification
- Direct Known Subclasses:
NumericAttributeModification
Abstract base class representing a modification to an EMF-based simulation
scenario. Subclasses define concrete ways of altering model attributes,
parameters, or structure.
Each concrete modification must:
- Provide its
name()anddescription() - Define how to apply itself to a scenario in
modify(EObject)method - Declare whether it is applicable to a given scenario in
isApplicable(EObject)method
A default identity modification is provided via identity(), which
performs no changes.
- Author:
- Andrey Malykhanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringReturns a more detailed description of the modification.static Modificationidentity()Returns a singleton identity modification that performs no changes.abstract booleanisApplicable(org.eclipse.emf.ecore.EObject scenario) Indicates whether this modification is applicable to a given scenario.booleanChecks whether this is the identity (empty) modification.abstract org.eclipse.emf.ecore.EObjectmodify(org.eclipse.emf.ecore.EObject baseScenario) Applies the modification to a given base scenario and returns the modified copy of the base scenario.abstract Stringname()Returns the name of the modification.toString()
-
Constructor Details
-
Modification
public Modification()
-
-
Method Details
-
identity
Returns a singleton identity modification that performs no changes.- Returns:
- a
Modificationinstance representing the empty (identity) modification
-
name
Returns the name of the modification. Used for UI display, logging, or reports.- Returns:
- the human-readable name of the modification
-
description
Returns a more detailed description of the modification.- Returns:
- a human-readable explanation of what this modification does
-
modify
public abstract org.eclipse.emf.ecore.EObject modify(org.eclipse.emf.ecore.EObject baseScenario) Applies the modification to a given base scenario and returns the modified copy of the base scenario. Implementations must return a modified deep copy of the input scenario, typically done usingEcoreUtil.copy(EObject)method.- Parameters:
baseScenario- the original EMF scenario to modify- Returns:
- a new
EObjectrepresenting the modified scenario
-
isApplicable
public abstract boolean isApplicable(org.eclipse.emf.ecore.EObject scenario) Indicates whether this modification is applicable to a given scenario. Applicability means there are certain objects and values that will be changed by this modification. Inapplicable modifications are usually not shown in the UI.- Parameters:
scenario- the scenario to check applicability for- Returns:
trueif this modification can be applied; otherwisefalse
-
isIdentity
public boolean isIdentity()Checks whether this is the identity (empty) modification.- Returns:
trueif this modification is the identity modification;falseotherwise
-
toString
-