1 | package de.uka.ipd.sdq.pcm.dialogs.variableusage; |
2 | |
3 | import java.util.ArrayList; |
4 | |
5 | import de.uka.ipd.sdq.pcm.repository.EventType; |
6 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
7 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
8 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
9 | import de.uka.ipd.sdq.pcm.repository.ParameterModifier; |
10 | import de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall; |
11 | |
12 | /** |
13 | * This content provider collects the parameters of a parent object |
14 | * to be used in a variable usage. |
15 | * |
16 | * @author Benjamin Klatt |
17 | * @author groenda |
18 | */ |
19 | public class VariableUsageInputParameterContentProvider extends |
20 | VariableUsageContentProvider { |
21 | |
22 | @Override |
23 | public Object[] getChildren(Object parent) { |
24 | if (parent instanceof OperationSignature) { |
25 | /* |
26 | * Operation Signature Parameter |
27 | */ |
28 | OperationSignature signature = (OperationSignature) parent; |
29 | ArrayList<Parameter> inputParameter = new ArrayList<Parameter>(); |
30 | for (Parameter p : signature.getParameters__OperationSignature()) { |
31 | if (p.getModifier__Parameter() == ParameterModifier.NONE || |
32 | p.getModifier__Parameter() == ParameterModifier.IN || |
33 | p.getModifier__Parameter() == ParameterModifier.INOUT){ |
34 | inputParameter.add(p); |
35 | } |
36 | } |
37 | return inputParameter.toArray(); |
38 | } else if (parent instanceof EventType) { |
39 | /* |
40 | * Event Type Parameter |
41 | */ |
42 | EventType eventType = (EventType) parent; |
43 | return new Object[]{eventType.getParameter__EventType()}; |
44 | } else if (parent instanceof InfrastructureSignature) { |
45 | /* |
46 | * Infrastructure Signature Parameters |
47 | */ |
48 | InfrastructureSignature signature = (InfrastructureSignature) parent; |
49 | ArrayList<Parameter> inputParameter = new ArrayList<Parameter>(); |
50 | for (Parameter p : signature.getParameters__InfrastructureSignature()) { |
51 | if (p.getModifier__Parameter() == ParameterModifier.NONE || |
52 | p.getModifier__Parameter() == ParameterModifier.IN || |
53 | p.getModifier__Parameter() == ParameterModifier.INOUT){ |
54 | inputParameter.add(p); |
55 | } |
56 | } |
57 | return inputParameter.toArray(); |
58 | } else { |
59 | return super.getChildren(parent); |
60 | } |
61 | } |
62 | |
63 | } |