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

COVERAGE SUMMARY FOR SOURCE FILE [ParameterRepresentation.java]

nameclass, %method, %block, %line, %
ParameterRepresentation.java0%   (0/1)0%   (0/4)0%   (0/73)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParameterRepresentation0%   (0/1)0%   (0/4)0%   (0/73)0%   (0/19)
ParameterRepresentation (): void 0%   (0/1)0%   (0/3)0%   (0/1)
dataTypeToString (DataType): String 0%   (0/1)0%   (0/30)0%   (0/11)
deleteComma (String): String 0%   (0/1)0%   (0/14)0%   (0/3)
parametersToString (EList): String 0%   (0/1)0%   (0/26)0%   (0/4)

1package de.uka.ipd.sdq.pcm.dialogs.datatype;
2 
3import java.util.Iterator;
4 
5import org.eclipse.emf.common.util.EList;
6import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
7import org.eclipse.emf.edit.provider.IItemLabelProvider;
8 
9import de.uka.ipd.sdq.pcm.repository.DataType;
10import de.uka.ipd.sdq.pcm.repository.Parameter;
11import de.uka.ipd.sdq.pcm.repository.provider.RepositoryItemProviderAdapterFactory;
12import de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;
13 
14/**
15 * Responsibly for representation different Signature property (ReturnType,
16 * Parameters, Exceptions), as string
17 * 
18 * @author Roman Andrej
19 */
20public class ParameterRepresentation {
21 
22        /**
23         * Represents DataType in accordance with Palladio styles
24         */
25        public static String dataTypeToString(DataType returnType) {
26 
27                String result = "";
28 
29                ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory();
30                adapterFactory
31                                .addAdapterFactory(new RepositoryItemProviderAdapterFactory());
32 
33                PalladioItemProviderAdapterFactory decoratedFactory = new PalladioItemProviderAdapterFactory(
34                                adapterFactory);
35 
36                if (returnType != null) {
37                        IItemLabelProvider datatypeProvider = (IItemLabelProvider) decoratedFactory
38                                        .adapt((Object) returnType, IItemLabelProvider.class);
39                        result = datatypeProvider.getText(returnType);
40                }
41 
42                return result;
43        }
44 
45        /**
46         * The method create the string list of parameter (parameter1, parameter2, ...)
47         */
48        public static String parametersToString(EList<Parameter> parameters) {
49                String result = "";
50 
51                for (Iterator<Parameter> it = parameters.iterator(); it.hasNext();) {
52                        result += it.next().getParameterName() + ", ";
53                }
54                return deleteComma(result);
55        }
56 
57        /**
58         * Comma of the sentence deletes ends
59         */
60        private static String deleteComma(String result) {
61                if (!result.equals("")) {
62                        result = result.substring(0, result.length() - 2);
63                }
64                return result;
65        }
66}

[all classes][de.uka.ipd.sdq.pcm.dialogs.datatype]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov