EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcmbench.tabs.parameters]

COVERAGE SUMMARY FOR SOURCE FILE [ParameterContentProvider.java]

nameclass, %method, %block, %line, %
ParameterContentProvider.java0%   (0/1)0%   (0/5)0%   (0/110)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParameterContentProvider0%   (0/1)0%   (0/5)0%   (0/110)0%   (0/30)
ParameterContentProvider (): void 0%   (0/1)0%   (0/3)0%   (0/1)
dispose (): void 0%   (0/1)0%   (0/1)0%   (0/1)
getElements (Object): Object [] 0%   (0/1)0%   (0/25)0%   (0/10)
inputChanged (Viewer, Object, Object): void 0%   (0/1)0%   (0/1)0%   (0/1)
meargeParameter (EList, EList): Object [] 0%   (0/1)0%   (0/80)0%   (0/17)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcmbench.tabs.parameters;
5 
6import java.util.ArrayList;
7import java.util.List;
8 
9import org.eclipse.emf.common.util.EList;
10import org.eclipse.jface.viewers.IStructuredContentProvider;
11import org.eclipse.jface.viewers.Viewer;
12 
13import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
14import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
15import de.uka.ipd.sdq.pcm.repository.BasicComponent;
16 
17/**
18 * @author Roman Andrej
19 */
20public class ParameterContentProvider implements IStructuredContentProvider {
21 
22        /* (non-Javadoc)
23         * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
24         */
25        public Object[] getElements(Object inputElement) {
26 
27                if (inputElement instanceof AssemblyContext) {
28                        AssemblyContext context = (AssemblyContext) inputElement;
29 
30                        EList<VariableUsage> contextParametrs = context
31                                        .getConfigParameterUsages__AssemblyContext();
32                        if (context.getEncapsulatedComponent__AssemblyContext() instanceof BasicComponent){
33                                EList<VariableUsage> componentParameters = ((BasicComponent) context
34                                                .getEncapsulatedComponent__AssemblyContext())
35                                                .getComponentParameterUsage_ImplementationComponentType();
36                                return meargeParameter(contextParametrs, componentParameters);
37 
38                        }
39                        
40                }
41 
42                return null;
43        }
44        
45        private Object[] meargeParameter(EList<VariableUsage> ctxParameters,
46                        EList<VariableUsage> cmpParameters) {
47 
48                VariableUsageWrapper removeWrapper = null;
49 
50                List<VariableUsageWrapper> parametrs = new ArrayList<VariableUsageWrapper>();
51 
52                for (VariableUsage variableUsage : cmpParameters) {
53                        parametrs.add(new VariableUsageWrapper(variableUsage));
54                }
55 
56                for (VariableUsage ctx_variableUsage : ctxParameters) {
57                        VariableUsageWrapper wrapper = new VariableUsageWrapper(
58                                        ctx_variableUsage, true);
59                        for (VariableUsageWrapper cmpWrapper : parametrs) {
60                                if (wrapper.equals(cmpWrapper)) {
61                                        removeWrapper = cmpWrapper;
62                                }
63 
64                        }
65 
66                        int index = parametrs.size();
67 
68                        if (removeWrapper != null) {
69                                index = parametrs.indexOf(removeWrapper);
70                                parametrs.remove(removeWrapper);
71                                removeWrapper = null;
72                        }
73 
74                        parametrs.add(index, wrapper);
75                }
76 
77                return parametrs.toArray();
78        }
79        
80 
81        /*
82         * (non-Javadoc)
83         * 
84         * @see org.eclipse.jface.viewers.IContentProvider#dispose()
85         */
86        public void dispose() {
87                // The implementation is not necessary.
88        }
89 
90        /* (non-Javadoc)
91         * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
92         */
93        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
94                // The implementation is not necessary.
95        }
96}

[all classes][de.uka.ipd.sdq.pcmbench.tabs.parameters]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov