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