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 | |
12 | import de.uka.ipd.sdq.probfunction.ExponentialDistribution; |
13 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
14 | |
15 | /** |
16 | * <!-- begin-user-doc --> |
17 | * An implementation of the model object '<em><b>Exponential Distribution</b></em>'. |
18 | * <!-- end-user-doc --> |
19 | * <p> |
20 | * The following features are implemented: |
21 | * <ul> |
22 | * <li>{@link de.uka.ipd.sdq.probfunction.impl.ExponentialDistributionImpl#getRate <em>Rate</em>}</li> |
23 | * </ul> |
24 | * </p> |
25 | * |
26 | * @generated |
27 | */ |
28 | public class ExponentialDistributionImpl extends ContinuousPDFImpl implements ExponentialDistribution { |
29 | /** |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
35 | |
36 | /** |
37 | * The default value of the '{@link #getRate() <em>Rate</em>}' attribute. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @see #getRate() |
41 | * @generated |
42 | * @ordered |
43 | */ |
44 | protected static final double RATE_EDEFAULT = 0.0; |
45 | |
46 | /** |
47 | * The cached value of the '{@link #getRate() <em>Rate</em>}' attribute. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @see #getRate() |
51 | * @generated |
52 | * @ordered |
53 | */ |
54 | protected double rate = RATE_EDEFAULT; |
55 | |
56 | /** |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | protected ExponentialDistributionImpl() { |
62 | super(); |
63 | } |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | @Override |
71 | protected EClass eStaticClass() { |
72 | return ProbfunctionPackage.Literals.EXPONENTIAL_DISTRIBUTION; |
73 | } |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | public double getRate() { |
81 | return rate; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public void setRate(double newRate) { |
90 | double oldRate = rate; |
91 | rate = newRate; |
92 | if (eNotificationRequired()) |
93 | eNotify(new ENotificationImpl(this, Notification.SET, ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE, oldRate, rate)); |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | @Override |
102 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
103 | switch (featureID) { |
104 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE: |
105 | return getRate(); |
106 | } |
107 | return super.eGet(featureID, resolve, coreType); |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public void eSet(int featureID, Object newValue) { |
117 | switch (featureID) { |
118 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE: |
119 | setRate((Double)newValue); |
120 | return; |
121 | } |
122 | super.eSet(featureID, newValue); |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | @Override |
131 | public void eUnset(int featureID) { |
132 | switch (featureID) { |
133 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE: |
134 | setRate(RATE_EDEFAULT); |
135 | return; |
136 | } |
137 | super.eUnset(featureID); |
138 | } |
139 | |
140 | /** |
141 | * <!-- begin-user-doc --> |
142 | * <!-- end-user-doc --> |
143 | * @generated |
144 | */ |
145 | @Override |
146 | public boolean eIsSet(int featureID) { |
147 | switch (featureID) { |
148 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE: |
149 | return rate != RATE_EDEFAULT; |
150 | } |
151 | return super.eIsSet(featureID); |
152 | } |
153 | |
154 | /** |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public String toString() { |
161 | if (eIsProxy()) return super.toString(); |
162 | |
163 | StringBuffer result = new StringBuffer(super.toString()); |
164 | result.append(" (rate: "); |
165 | result.append(rate); |
166 | result.append(')'); |
167 | return result.toString(); |
168 | } |
169 | |
170 | } //ExponentialDistributionImpl |