1 | package de.uka.ipd.sdq.pcm.dialogs.resource; |
2 | |
3 | import org.eclipse.emf.ecore.EObject; |
4 | |
5 | import de.uka.ipd.sdq.pcm.dialogs.OpenStoExDialog; |
6 | import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification; |
7 | import de.uka.ipd.sdq.stoex.RandomVariable; |
8 | import de.uka.ipd.sdq.stoex.analyser.visitors.TypeEnum; |
9 | |
10 | // Manually written open policy to open the StoEx Dialog. It's |
11 | // called via a CustomBehaviour in the genmap |
12 | public class OpenProcessingRateDialog extends OpenStoExDialog { |
13 | |
14 | |
15 | @Override |
16 | protected RandomVariable getRandomVariable(EObject parent) { |
17 | // Default Implementation. Override as necessary |
18 | if (randomVariableFeature == null && parent instanceof RandomVariable) { |
19 | return (RandomVariable) parent; |
20 | } else if (randomVariableFeature == null |
21 | && parent instanceof ProcessingResourceSpecification) { |
22 | return ((ProcessingResourceSpecification) parent) |
23 | .getProcessingRate_ProcessingResourceSpecification(); |
24 | } else { |
25 | return (RandomVariable) parent.eGet(randomVariableFeature); |
26 | } |
27 | |
28 | // ProcessingResourceSpecification resourceSpecification = (ProcessingResourceSpecification) parent; |
29 | // RandomVariable rv = resourceSpecification.getProcessingRate_ProcessingResourceSpecification(); |
30 | // return rv; |
31 | } |
32 | |
33 | @Override |
34 | protected TypeEnum getExpectedType(RandomVariable rv) { |
35 | return TypeEnum.DOUBLE; |
36 | } |
37 | |
38 | } |