Package de.uka.ipd.sdq.dsexplore.helper
Class FixDesignDecisionReferenceSwitch
- java.lang.Object
-
- org.eclipse.emf.ecore.util.Switch<T>
-
- de.uka.ipd.sdq.pcm.designdecision.util.designdecisionSwitch<EObject>
-
- de.uka.ipd.sdq.dsexplore.helper.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 Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.Logger
logger
-
Fields inherited from class de.uka.ipd.sdq.pcm.designdecision.util.designdecisionSwitch
modelPackage
-
-
Constructor Summary
Constructors Constructor Description FixDesignDecisionReferenceSwitch(org.palladiosimulator.solver.models.PCMInstance initialInstance2)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EObject
caseCandidate(Candidate object)
Returns the result of interpreting the object as an instance of 'Candidate'.EObject
caseCandidates(Candidates object)
Returns the result of interpreting the object as an instance of 'Candidates'.EObject
caseChoice(Choice object)
Returns the result of interpreting the object as an instance of 'Choice'.EObject
caseClassChoice(ClassChoice object)
Returns the result of interpreting the object as an instance of 'Class Choice'.EObject
caseDecisionSpace(DecisionSpace object)
Returns the result of interpreting the object as an instance of 'Decision Space'.EObject
defaultCase(EObject eObject)
Returns the result of interpreting the object as an instance of 'EObject'.void
fixEntitiesForDomain(List<EObject> eListToUpdate, List<org.palladiosimulator.pcm.core.entity.Entity> memoryEntityList)
-
Methods inherited from class de.uka.ipd.sdq.pcm.designdecision.util.designdecisionSwitch
caseBoolChoice, caseContinousRangeChoice, caseDegreeOfFreedomInstance, caseDiscreteRangeChoice, caseFeatureChoice, casefeaturemodel_NamedElement, caseIdentifier, caseNamedElement, doSwitch, isSwitchFor
-
-
-
-
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 classdesigndecisionSwitch<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 classdesigndecisionSwitch<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 classdesigndecisionSwitch<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 classdesigndecisionSwitch<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 classdesigndecisionSwitch<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)
-
defaultCase
public EObject defaultCase(EObject eObject)
Description copied from class:designdecisionSwitch
Returns the result of interpreting the object as an instance of 'EObject'. This implementation returns null; returning a non-null result will terminate the switch, but this is the last case anyway.- Overrides:
defaultCase
in classdesigndecisionSwitch<EObject>
- Parameters:
eObject
- the target of the switch.- Returns:
- the result of interpreting the object as an instance of 'EObject'.
- See Also:
Switch.doSwitch(org.eclipse.emf.ecore.EObject)
-
-