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