Class Modification

java.lang.Object
com.amalgamasimulation.studies.core.Modification
Direct Known Subclasses:
NumericAttributeModification

public abstract class Modification extends Object
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:

A default identity modification is provided via identity(), which performs no changes.

Author:
Andrey Malykhanov
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract String
    Returns a more detailed description of the modification.
    Returns a singleton identity modification that performs no changes.
    abstract boolean
    isApplicable(org.eclipse.emf.ecore.EObject scenario)
    Indicates whether this modification is applicable to a given scenario.
    boolean
    Checks whether this is the identity (empty) modification.
    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.
    abstract String
    Returns the name of the modification.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Modification

      public Modification()
  • Method Details

    • identity

      public static Modification identity()
      Returns a singleton identity modification that performs no changes.
      Returns:
      a Modification instance representing the empty (identity) modification
    • name

      public abstract String name()
      Returns the name of the modification. Used for UI display, logging, or reports.
      Returns:
      the human-readable name of the modification
    • description

      public abstract String 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 using EcoreUtil.copy(EObject) method.
      Parameters:
      baseScenario - the original EMF scenario to modify
      Returns:
      a new EObject representing 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:
      true if this modification can be applied; otherwise false
    • isIdentity

      public boolean isIdentity()
      Checks whether this is the identity (empty) modification.
      Returns:
      true if this modification is the identity modification; false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object