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
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 inherited from class de.uka.ipd.sdq.pcm.designdecision.util.designdecisionSwitch
modelPackage
-
Constructor Summary
ConstructorDescriptionFixDesignDecisionReferenceSwitch
(org.palladiosimulator.solver.models.PCMInstance initialInstance2) -
Method Summary
Modifier and TypeMethodDescriptioncaseCandidate
(Candidate object) Returns the result of interpreting the object as an instance of 'Candidate'.caseCandidates
(Candidates object) Returns the result of interpreting the object as an instance of 'Candidates'.caseChoice
(Choice object) Returns the result of interpreting the object as an instance of 'Choice'.caseClassChoice
(ClassChoice object) Returns the result of interpreting the object as an instance of 'Class Choice'.caseDecisionSpace
(DecisionSpace object) Returns the result of interpreting the object as an instance of 'Decision Space'.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
-
Field Details
-
logger
protected static org.apache.log4j.Logger logger
-
-
Constructor Details
-
FixDesignDecisionReferenceSwitch
public FixDesignDecisionReferenceSwitch(org.palladiosimulator.solver.models.PCMInstance initialInstance2)
-
-
Method Details
-
fixEntitiesForDomain
-
caseCandidate
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:
-
caseCandidates
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:
-
caseChoice
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:
-
caseClassChoice
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:
-
caseDecisionSpace
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:
-
defaultCase
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:
-