| 1 | /** |
| 2 | * |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.dialogs.parameters; |
| 5 | |
| 6 | import org.eclipse.emf.common.util.EList; |
| 7 | |
| 8 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
| 9 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
| 10 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
| 11 | import de.uka.ipd.sdq.pcm.repository.Signature; |
| 12 | |
| 13 | /**Utility class for parameter handling. |
| 14 | * @author groenda |
| 15 | * |
| 16 | */ |
| 17 | public class ParametersUtil { |
| 18 | |
| 19 | /**Returns all parameters of a given signature. |
| 20 | * @param signature The signature. |
| 21 | * @return The parameters. |
| 22 | */ |
| 23 | public static EList<Parameter> getParametersOfSignature(final Signature signature){ |
| 24 | if (signature instanceof OperationSignature) |
| 25 | return ((OperationSignature)signature).getParameters__OperationSignature(); |
| 26 | if (signature instanceof InfrastructureSignature) |
| 27 | return ((InfrastructureSignature)signature).getParameters__InfrastructureSignature(); |
| 28 | throw new IllegalArgumentException("Unkown signature type experienced: " + signature.eClass().getName()); |
| 29 | } |
| 30 | } |