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

COVERAGE SUMMARY FOR SOURCE FILE [VariableLinkingResourceCostImpl.java]

nameclass, %method, %block, %line, %
VariableLinkingResourceCostImpl.java0%   (0/1)0%   (0/21)0%   (0/360)0%   (0/92)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VariableLinkingResourceCostImpl0%   (0/1)0%   (0/21)0%   (0/360)0%   (0/92)
VariableLinkingResourceCostImpl (): void 0%   (0/1)0%   (0/9)0%   (0/4)
basicGetAnnotatedElement (): EObject 0%   (0/1)0%   (0/3)0%   (0/1)
basicGetLinkingresource (): LinkingResource 0%   (0/1)0%   (0/3)0%   (0/1)
eBaseStructuralFeatureID (int, Class): int 0%   (0/1)0%   (0/14)0%   (0/5)
eDerivedStructuralFeatureID (int, Class): int 0%   (0/1)0%   (0/14)0%   (0/5)
eGet (int, boolean, boolean): Object 0%   (0/1)0%   (0/24)0%   (0/6)
eIsSet (int): boolean 0%   (0/1)0%   (0/31)0%   (0/5)
eSet (int, Object): void 0%   (0/1)0%   (0/24)0%   (0/9)
eStaticClass (): EClass 0%   (0/1)0%   (0/2)0%   (0/1)
eUnset (int): void 0%   (0/1)0%   (0/18)0%   (0/9)
getBandwidthOperatingFactor (): double 0%   (0/1)0%   (0/3)0%   (0/1)
getBandwithInitialFactor (): double 0%   (0/1)0%   (0/3)0%   (0/1)
getInitialCost (): double 0%   (0/1)0%   (0/9)0%   (0/1)
getLatency (): double 0%   (0/1)0%   (0/28)0%   (0/6)
getLinkingresource (): LinkingResource 0%   (0/1)0%   (0/38)0%   (0/7)
getOperatingCost (): double 0%   (0/1)0%   (0/9)0%   (0/1)
getThroughput (): double 0%   (0/1)0%   (0/28)0%   (0/6)
setBandwidthOperatingFactor (double): void 0%   (0/1)0%   (0/21)0%   (0/5)
setBandwithInitialFactor (double): void 0%   (0/1)0%   (0/21)0%   (0/5)
setLinkingresource (LinkingResource): void 0%   (0/1)0%   (0/21)0%   (0/5)
toString (): String 0%   (0/1)0%   (0/37)0%   (0/8)

1/**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7package de.uka.ipd.sdq.pcm.cost.impl;
8 
9import de.uka.ipd.sdq.pcm.cost.LinkingResourceCost;
10import org.eclipse.emf.common.notify.Notification;
11import org.eclipse.emf.ecore.EClass;
12import org.eclipse.emf.ecore.EObject;
13import org.eclipse.emf.ecore.InternalEObject;
14import org.eclipse.emf.ecore.impl.ENotificationImpl;
15 
16import de.uka.ipd.sdq.pcm.cost.VariableLinkingResourceCost;
17import de.uka.ipd.sdq.pcm.cost.costPackage;
18import de.uka.ipd.sdq.pcm.cost.helper.CostUtil;
19import de.uka.ipd.sdq.pcm.resourceenvironment.LinkingResource;
20 
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Variable Linking Resource Cost</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * <ul>
28 *   <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableLinkingResourceCostImpl#getLinkingresource <em>Linkingresource</em>}</li>
29 *   <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableLinkingResourceCostImpl#getBandwithInitialFactor <em>Bandwith Initial Factor</em>}</li>
30 *   <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableLinkingResourceCostImpl#getBandwidthOperatingFactor <em>Bandwidth Operating Factor</em>}</li>
31 * </ul>
32 * </p>
33 *
34 * @generated
35 */
36public class VariableLinkingResourceCostImpl extends VariableCostImpl implements VariableLinkingResourceCost {
37        /**
38         * The cached value of the '{@link #getLinkingresource() <em>Linkingresource</em>}' reference.
39         * <!-- begin-user-doc -->
40         * <!-- end-user-doc -->
41         * @see #getLinkingresource()
42         * @generated
43         * @ordered
44         */
45        protected LinkingResource linkingresource;
46 
47        /**
48         * The default value of the '{@link #getBandwithInitialFactor() <em>Bandwith Initial Factor</em>}' attribute.
49         * <!-- begin-user-doc -->
50         * <!-- end-user-doc -->
51         * @see #getBandwithInitialFactor()
52         * @generated
53         * @ordered
54         */
55        protected static final double BANDWITH_INITIAL_FACTOR_EDEFAULT = 0.0;
56 
57        /**
58         * The cached value of the '{@link #getBandwithInitialFactor() <em>Bandwith Initial Factor</em>}' attribute.
59         * <!-- begin-user-doc -->
60         * <!-- end-user-doc -->
61         * @see #getBandwithInitialFactor()
62         * @generated
63         * @ordered
64         */
65        protected double bandwithInitialFactor = BANDWITH_INITIAL_FACTOR_EDEFAULT;
66 
67        /**
68         * The default value of the '{@link #getBandwidthOperatingFactor() <em>Bandwidth Operating Factor</em>}' attribute.
69         * <!-- begin-user-doc -->
70         * <!-- end-user-doc -->
71         * @see #getBandwidthOperatingFactor()
72         * @generated
73         * @ordered
74         */
75        protected static final double BANDWIDTH_OPERATING_FACTOR_EDEFAULT = 0.0;
76 
77        /**
78         * The cached value of the '{@link #getBandwidthOperatingFactor() <em>Bandwidth Operating Factor</em>}' attribute.
79         * <!-- begin-user-doc -->
80         * <!-- end-user-doc -->
81         * @see #getBandwidthOperatingFactor()
82         * @generated
83         * @ordered
84         */
85        protected double bandwidthOperatingFactor = BANDWIDTH_OPERATING_FACTOR_EDEFAULT;
86 
87        /**
88         * <!-- begin-user-doc -->
89         * <!-- end-user-doc -->
90         * @generated
91         */
92        protected VariableLinkingResourceCostImpl() {
93                super();
94        }
95 
96        /**
97         * <!-- begin-user-doc -->
98         * <!-- end-user-doc -->
99         * @generated
100         */
101        @Override
102        protected EClass eStaticClass() {
103                return costPackage.Literals.VARIABLE_LINKING_RESOURCE_COST;
104        }
105 
106        /**
107         * <!-- begin-user-doc -->
108         * <!-- end-user-doc -->
109         * @generated
110         */
111        public double getBandwithInitialFactor() {
112                return bandwithInitialFactor;
113        }
114 
115        /**
116         * <!-- begin-user-doc -->
117         * <!-- end-user-doc -->
118         * @generated
119         */
120        public void setBandwithInitialFactor(double newBandwithInitialFactor) {
121                double oldBandwithInitialFactor = bandwithInitialFactor;
122                bandwithInitialFactor = newBandwithInitialFactor;
123                if (eNotificationRequired())
124                        eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR, oldBandwithInitialFactor, bandwithInitialFactor));
125        }
126 
127        /**
128         * <!-- begin-user-doc -->
129         * <!-- end-user-doc -->
130         * @generated
131         */
132        public double getBandwidthOperatingFactor() {
133                return bandwidthOperatingFactor;
134        }
135 
136        /**
137         * <!-- begin-user-doc -->
138         * <!-- end-user-doc -->
139         * @generated
140         */
141        public void setBandwidthOperatingFactor(double newBandwidthOperatingFactor) {
142                double oldBandwidthOperatingFactor = bandwidthOperatingFactor;
143                bandwidthOperatingFactor = newBandwidthOperatingFactor;
144                if (eNotificationRequired())
145                        eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR, oldBandwidthOperatingFactor, bandwidthOperatingFactor));
146        }
147 
148        /**
149         * <!-- begin-user-doc -->
150         * <!-- end-user-doc -->
151         * @generated
152         */
153        public LinkingResource getLinkingresource() {
154                if (linkingresource != null && linkingresource.eIsProxy()) {
155                        InternalEObject oldLinkingresource = (InternalEObject)linkingresource;
156                        linkingresource = (LinkingResource)eResolveProxy(oldLinkingresource);
157                        if (linkingresource != oldLinkingresource) {
158                                if (eNotificationRequired())
159                                        eNotify(new ENotificationImpl(this, Notification.RESOLVE, costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE, oldLinkingresource, linkingresource));
160                        }
161                }
162                return linkingresource;
163        }
164 
165        /**
166         * <!-- begin-user-doc -->
167         * <!-- end-user-doc -->
168         * @generated
169         */
170        public LinkingResource basicGetLinkingresource() {
171                return linkingresource;
172        }
173 
174        /**
175         * <!-- begin-user-doc -->
176         * <!-- end-user-doc -->
177         * @generated
178         */
179        public void setLinkingresource(LinkingResource newLinkingresource) {
180                LinkingResource oldLinkingresource = linkingresource;
181                linkingresource = newLinkingresource;
182                if (eNotificationRequired())
183                        eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE, oldLinkingresource, linkingresource));
184        }
185 
186        /**
187         * <!-- begin-user-doc -->
188         * <!-- end-user-doc -->
189         * @generated
190         */
191        @Override
192        public Object eGet(int featureID, boolean resolve, boolean coreType) {
193                switch (featureID) {
194                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE:
195                                if (resolve) return getLinkingresource();
196                                return basicGetLinkingresource();
197                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR:
198                                return getBandwithInitialFactor();
199                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR:
200                                return getBandwidthOperatingFactor();
201                }
202                return super.eGet(featureID, resolve, coreType);
203        }
204 
205        /**
206         * <!-- begin-user-doc -->
207         * <!-- end-user-doc -->
208         * @generated
209         */
210        @Override
211        public void eSet(int featureID, Object newValue) {
212                switch (featureID) {
213                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE:
214                                setLinkingresource((LinkingResource)newValue);
215                                return;
216                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR:
217                                setBandwithInitialFactor((Double)newValue);
218                                return;
219                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR:
220                                setBandwidthOperatingFactor((Double)newValue);
221                                return;
222                }
223                super.eSet(featureID, newValue);
224        }
225 
226        /**
227         * <!-- begin-user-doc -->
228         * <!-- end-user-doc -->
229         * @generated
230         */
231        @Override
232        public void eUnset(int featureID) {
233                switch (featureID) {
234                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE:
235                                setLinkingresource((LinkingResource)null);
236                                return;
237                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR:
238                                setBandwithInitialFactor(BANDWITH_INITIAL_FACTOR_EDEFAULT);
239                                return;
240                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR:
241                                setBandwidthOperatingFactor(BANDWIDTH_OPERATING_FACTOR_EDEFAULT);
242                                return;
243                }
244                super.eUnset(featureID);
245        }
246 
247        /**
248         * <!-- begin-user-doc -->
249         * <!-- end-user-doc -->
250         * @generated
251         */
252        @Override
253        public boolean eIsSet(int featureID) {
254                switch (featureID) {
255                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE:
256                                return linkingresource != null;
257                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR:
258                                return bandwithInitialFactor != BANDWITH_INITIAL_FACTOR_EDEFAULT;
259                        case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR:
260                                return bandwidthOperatingFactor != BANDWIDTH_OPERATING_FACTOR_EDEFAULT;
261                }
262                return super.eIsSet(featureID);
263        }
264 
265        /**
266         * <!-- begin-user-doc -->
267         * <!-- end-user-doc -->
268         * @generated
269         */
270        @Override
271        public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
272                if (baseClass == LinkingResourceCost.class) {
273                        switch (derivedFeatureID) {
274                                case costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE: return costPackage.LINKING_RESOURCE_COST__LINKINGRESOURCE;
275                                default: return -1;
276                        }
277                }
278                return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
279        }
280 
281        /**
282         * <!-- begin-user-doc -->
283         * <!-- end-user-doc -->
284         * @generated
285         */
286        @Override
287        public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
288                if (baseClass == LinkingResourceCost.class) {
289                        switch (baseFeatureID) {
290                                case costPackage.LINKING_RESOURCE_COST__LINKINGRESOURCE: return costPackage.VARIABLE_LINKING_RESOURCE_COST__LINKINGRESOURCE;
291                                default: return -1;
292                        }
293                }
294                return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
295        }
296 
297        /**
298         * <!-- begin-user-doc -->
299         * <!-- end-user-doc -->
300         * @generated
301         */
302        @Override
303        public String toString() {
304                if (eIsProxy()) return super.toString();
305 
306                StringBuffer result = new StringBuffer(super.toString());
307                result.append(" (bandwithInitialFactor: ");
308                result.append(bandwithInitialFactor);
309                result.append(", bandwidthOperatingFactor: ");
310                result.append(bandwidthOperatingFactor);
311                result.append(')');
312                return result.toString();
313        }
314 
315        /**
316         * <!-- begin-user-doc -->
317         * <!-- end-user-doc -->
318         * @generated not
319         */
320        @Override
321        public double getOperatingCost() {
322                return this.getFixedOperatingCost() + this.bandwidthOperatingFactor * this.getThroughput();
323        }
324 
325        /**
326         * <!-- begin-user-doc -->
327         * <!-- end-user-doc -->
328         * @generated not
329         */
330        @Override
331        public double getInitialCost() {
332                return this.getFixedInitialCost() + this.getBandwithInitialFactor() * this.getThroughput();
333        }
334        
335        /**
336         * <!-- begin-user-doc -->
337         * <!-- end-user-doc -->
338         * @generated not
339         */
340        private double getThroughput() {
341                //TODO: what about longs and shorts and stuff here? 
342                if ( this.getLinkingresource() != null 
343                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource() != null 
344                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getThroughput_CommunicationLinkResourceSpecification() != null
345                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getThroughput_CommunicationLinkResourceSpecification().getSpecification() != null ) {
346                        return CostUtil.getInstance().getDoubleFromSpecification(this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getThroughput_CommunicationLinkResourceSpecification().getSpecification());
347                } 
348                return 0;
349        }
350        
351        /**
352         * <!-- begin-user-doc -->
353         * <!-- end-user-doc -->
354         * @generated not
355         */
356        private double getLatency() {
357                //TODO: what about longs and shorts and stuff here? 
358                if ( this.getLinkingresource() != null 
359                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource() != null 
360                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getLatency_CommunicationLinkResourceSpecification() != null
361                                && this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getLatency_CommunicationLinkResourceSpecification().getSpecification() != null ) {
362                        return CostUtil.getInstance().getDoubleFromSpecification(this.getLinkingresource().getCommunicationLinkResourceSpecifications_LinkingResource().getLatency_CommunicationLinkResourceSpecification().getSpecification());
363                } 
364                return 0;
365        }
366 
367        @Override
368        public EObject basicGetAnnotatedElement() {
369                return this.getLinkingresource();
370        }
371 
372} //VariableLinkingResourceCostImpl

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