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