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