Class FixDesignDecisionReferenceSwitch


  • public class FixDesignDecisionReferenceSwitch
    extends designdecisionSwitch<EObject>
    This class fixes the references of designdecision models. The problem addressed is, that if you separately load a PCM model and a designdecision model, the object identities of the loaded elements are not the same. For example, a basic component A may be represented by a Java object A1 when loaded directly from the repository file. When a degree of freedom model is loaded, and the PCM instance is accessed usingthe references in that model, the PCM model is loaded again and the component A is represented by a second Java object A2. Calling equals on A1 and A2 results in false. Thus, collection.contains(A1) will fail even if A2 is contained. Thus, this class fixes the references by replacing each reference to A2 to a reference to A1, so that only one consistent object tree represents the models at the end. XXX: Maybe this could be done more generically based on EObject and the structural features, without being meta model dependent. One solution idea was to just use the same EMF resource set when loading more models and then resolve proxies using ECoreUtil#resolveAll. Although this worked before 2011-02-24, it did not work anymore afterwards, so I reenabled this switch.
    • Field Detail

      • logger

        protected static org.apache.log4j.Logger logger
    • Constructor Detail

      • FixDesignDecisionReferenceSwitch

        public FixDesignDecisionReferenceSwitch​(org.palladiosimulator.solver.models.PCMInstance initialInstance2)
    • Method Detail

      • fixEntitiesForDomain

        public void fixEntitiesForDomain​(List<EObject> eListToUpdate,
                                         List<org.palladiosimulator.pcm.core.entity.Entity> memoryEntityList)
      • caseCandidate

        public EObject caseCandidate​(Candidate object)
        Description copied from class: designdecisionSwitch
        Returns the result of interpreting the object as an instance of 'Candidate'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseCandidate in class designdecisionSwitch<EObject>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Candidate'.
        See Also:
        doSwitch(EObject)
      • caseCandidates

        public EObject caseCandidates​(Candidates object)
        Description copied from class: designdecisionSwitch
        Returns the result of interpreting the object as an instance of 'Candidates'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseCandidates in class designdecisionSwitch<EObject>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Candidates'.
        See Also:
        doSwitch(EObject)
      • caseChoice

        public EObject caseChoice​(Choice object)
        Description copied from class: designdecisionSwitch
        Returns the result of interpreting the object as an instance of 'Choice'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseChoice in class designdecisionSwitch<EObject>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Choice'.
        See Also:
        doSwitch(EObject)
      • caseClassChoice

        public EObject caseClassChoice​(ClassChoice object)
        Description copied from class: designdecisionSwitch
        Returns the result of interpreting the object as an instance of 'Class Choice'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseClassChoice in class designdecisionSwitch<EObject>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Class Choice'.
        See Also:
        doSwitch(EObject)
      • caseDecisionSpace

        public EObject caseDecisionSpace​(DecisionSpace object)
        Description copied from class: designdecisionSwitch
        Returns the result of interpreting the object as an instance of 'Decision Space'. This implementation returns null; returning a non-null result will terminate the switch.
        Overrides:
        caseDecisionSpace in class designdecisionSwitch<EObject>
        Parameters:
        object - the target of the switch.
        Returns:
        the result of interpreting the object as an instance of 'Decision Space'.
        See Also:
        doSwitch(EObject)