1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.ecore.EClass; |
10 | import org.eclipse.emf.ecore.InternalEObject; |
11 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
12 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
13 | |
14 | import de.uka.ipd.sdq.context.computed_usage.BranchProbability; |
15 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
16 | import de.uka.ipd.sdq.pcm.seff.AbstractBranchTransition; |
17 | |
18 | /** |
19 | * <!-- begin-user-doc --> |
20 | * An implementation of the model object '<em><b>Branch Probability</b></em>'. |
21 | * <!-- end-user-doc --> |
22 | * <p> |
23 | * The following features are implemented: |
24 | * <ul> |
25 | * <li>{@link de.uka.ipd.sdq.context.computed_usage.impl.BranchProbabilityImpl#getProbability <em>Probability</em>}</li> |
26 | * <li>{@link de.uka.ipd.sdq.context.computed_usage.impl.BranchProbabilityImpl#getBranchtransition_BranchProbability <em>Branchtransition Branch Probability</em>}</li> |
27 | * </ul> |
28 | * </p> |
29 | * |
30 | * @generated |
31 | */ |
32 | public class BranchProbabilityImpl extends EObjectImpl implements BranchProbability { |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @generated |
37 | */ |
38 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
39 | |
40 | /** |
41 | * The default value of the '{@link #getProbability() <em>Probability</em>}' attribute. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @see #getProbability() |
45 | * @generated |
46 | * @ordered |
47 | */ |
48 | protected static final double PROBABILITY_EDEFAULT = 0.0; |
49 | |
50 | /** |
51 | * The cached value of the '{@link #getProbability() <em>Probability</em>}' attribute. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @see #getProbability() |
55 | * @generated |
56 | * @ordered |
57 | */ |
58 | protected double probability = PROBABILITY_EDEFAULT; |
59 | |
60 | /** |
61 | * The cached value of the '{@link #getBranchtransition_BranchProbability() <em>Branchtransition Branch Probability</em>}' reference. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @see #getBranchtransition_BranchProbability() |
65 | * @generated |
66 | * @ordered |
67 | */ |
68 | protected AbstractBranchTransition branchtransition_BranchProbability; |
69 | |
70 | /** |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | protected BranchProbabilityImpl() { |
76 | super(); |
77 | } |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | @Override |
85 | protected EClass eStaticClass() { |
86 | return ComputedUsagePackage.Literals.BRANCH_PROBABILITY; |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | public double getProbability() { |
95 | return probability; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public void setProbability(double newProbability) { |
104 | double oldProbability = probability; |
105 | probability = newProbability; |
106 | if (eNotificationRequired()) |
107 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY, oldProbability, probability)); |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public AbstractBranchTransition getBranchtransition_BranchProbability() { |
116 | if (branchtransition_BranchProbability != null && branchtransition_BranchProbability.eIsProxy()) { |
117 | InternalEObject oldBranchtransition_BranchProbability = (InternalEObject)branchtransition_BranchProbability; |
118 | branchtransition_BranchProbability = (AbstractBranchTransition)eResolveProxy(oldBranchtransition_BranchProbability); |
119 | if (branchtransition_BranchProbability != oldBranchtransition_BranchProbability) { |
120 | if (eNotificationRequired()) |
121 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY, oldBranchtransition_BranchProbability, branchtransition_BranchProbability)); |
122 | } |
123 | } |
124 | return branchtransition_BranchProbability; |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public AbstractBranchTransition basicGetBranchtransition_BranchProbability() { |
133 | return branchtransition_BranchProbability; |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | public void setBranchtransition_BranchProbability(AbstractBranchTransition newBranchtransition_BranchProbability) { |
142 | AbstractBranchTransition oldBranchtransition_BranchProbability = branchtransition_BranchProbability; |
143 | branchtransition_BranchProbability = newBranchtransition_BranchProbability; |
144 | if (eNotificationRequired()) |
145 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY, oldBranchtransition_BranchProbability, branchtransition_BranchProbability)); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
155 | switch (featureID) { |
156 | case ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY: |
157 | return getProbability(); |
158 | case ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY: |
159 | if (resolve) return getBranchtransition_BranchProbability(); |
160 | return basicGetBranchtransition_BranchProbability(); |
161 | } |
162 | return super.eGet(featureID, resolve, coreType); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @Override |
171 | public void eSet(int featureID, Object newValue) { |
172 | switch (featureID) { |
173 | case ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY: |
174 | setProbability((Double)newValue); |
175 | return; |
176 | case ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY: |
177 | setBranchtransition_BranchProbability((AbstractBranchTransition)newValue); |
178 | return; |
179 | } |
180 | super.eSet(featureID, newValue); |
181 | } |
182 | |
183 | /** |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | @Override |
189 | public void eUnset(int featureID) { |
190 | switch (featureID) { |
191 | case ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY: |
192 | setProbability(PROBABILITY_EDEFAULT); |
193 | return; |
194 | case ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY: |
195 | setBranchtransition_BranchProbability((AbstractBranchTransition)null); |
196 | return; |
197 | } |
198 | super.eUnset(featureID); |
199 | } |
200 | |
201 | /** |
202 | * <!-- begin-user-doc --> |
203 | * <!-- end-user-doc --> |
204 | * @generated |
205 | */ |
206 | @Override |
207 | public boolean eIsSet(int featureID) { |
208 | switch (featureID) { |
209 | case ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY: |
210 | return probability != PROBABILITY_EDEFAULT; |
211 | case ComputedUsagePackage.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY: |
212 | return branchtransition_BranchProbability != null; |
213 | } |
214 | return super.eIsSet(featureID); |
215 | } |
216 | |
217 | /** |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | @Override |
223 | public String toString() { |
224 | if (eIsProxy()) return super.toString(); |
225 | |
226 | StringBuffer result = new StringBuffer(super.toString()); |
227 | result.append(" (probability: "); |
228 | result.append(probability); |
229 | result.append(')'); |
230 | return result.toString(); |
231 | } |
232 | |
233 | } //BranchProbabilityImpl |