Class CategorialAttributeModification
java.lang.Object
com.amalgamasimulation.studies.core.Modification
com.amalgamasimulation.studies.core.CategorialAttributeModification
- All Implemented Interfaces:
VariationModification
- Direct Known Subclasses:
ReferenceAttributeModification,TimeSeriesAttributeModification
A
Modification that applies a numeric change to the specified
attribute of selected EMF objects of the specified type within a EMF data
model. The change can be either:
- Absolute: Replaces the current value with the given constant.
- Relative: Multiplies the current value by a factor.
The modification is applied to all EObjects matching the specified
type name, and optionally filtered by a list of object identifiers.
- Author:
- Andrey Malykhanov
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCategorialAttributeModification(String fieldName, String variationScopeDescription, Object value, VariationScope variationScope) Constructs a new categorial attribute modification. -
Method Summary
Modifier and TypeMethodDescriptionReturns a more detailed description of the modification.Returns the name of the attribute to be modified.booleanisApplicable(org.eclipse.emf.ecore.EObject scenario) Indicates whether this modification is applicable to a given scenario.protected voidmakeModification(org.eclipse.emf.ecore.EObject eObject) 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.name()Returns the name of the modification.objectIdentifier(org.eclipse.emf.ecore.EObject eObject) To be overridden in subclasses to extract the String ID of a given EObject.value()Returns the value to apply.Returns the variation scope.Returns the description of the variation scope.Methods inherited from class com.amalgamasimulation.studies.core.Modification
identity, isIdentity, toString
-
Field Details
-
variationScope
-
-
Constructor Details
-
CategorialAttributeModification
public CategorialAttributeModification(String fieldName, String variationScopeDescription, Object value, VariationScope variationScope) Constructs a new categorial attribute modification.- Parameters:
fieldName- the name of the attribute to modify (e.g., "setupDuration")variationScopeDescription- a human-readable description of the variation scope, used for reporting or documentation purposesvalue- the constant or multiplier to applyvariationScope- theVariationScopedefining whichEObjects the modification applies to (e.g., all objects of a given type, or a specific subset)
-
-
Method Details
-
fieldName
Returns the name of the attribute to be modified.- Returns:
- the field name
-
variationScopeDescription
Returns the description of the variation scope.- Returns:
- the variation scope description
-
value
Returns the value to apply. This is either a constant (absolute mode) or a multiplier (relative mode).- Returns:
- the numeric value used in the modification
-
variationScope
Returns the variation scope.- Returns:
- the variation scope
-
name
Description copied from class:ModificationReturns the name of the modification. Used for UI display, logging, or reports.- Specified by:
namein interfaceVariationModification- Specified by:
namein classModification- Returns:
- the human-readable name of the modification
-
description
Description copied from class:ModificationReturns a more detailed description of the modification.- Specified by:
descriptionin classModification- Returns:
- a human-readable explanation of what this modification does
-
modify
public org.eclipse.emf.ecore.EObject modify(org.eclipse.emf.ecore.EObject baseScenario) Description copied from class:ModificationApplies 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.- Specified by:
modifyin classModification- Parameters:
baseScenario- the original EMF scenario to modify- Returns:
- a new
EObjectrepresenting the modified scenario
-
makeModification
protected void makeModification(org.eclipse.emf.ecore.EObject eObject) -
objectIdentifier
To be overridden in subclasses to extract the String ID of a given EObject. By default, returnsOptional.empty()- Parameters:
eObject- the EMF object- Returns:
- an
Optionalcontaining the String identifier, orOptional.empty()if identifier can not be extracted
-
isApplicable
public boolean isApplicable(org.eclipse.emf.ecore.EObject scenario) Description copied from class:ModificationIndicates 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.- Specified by:
isApplicablein classModification- Parameters:
scenario- the scenario to check applicability for- Returns:
trueif this modification can be applied; otherwisefalse
-
valueString
- Specified by:
valueStringin interfaceVariationModification
-