| 1 | /** |
| 2 | * Copyright 2007-2009, SDQ, IPD, U Karlsruhe |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.probfunction.impl; |
| 7 | |
| 8 | import de.uka.ipd.sdq.probfunction.GammaDistribution; |
| 9 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
| 10 | |
| 11 | import org.eclipse.emf.common.notify.Notification; |
| 12 | |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | |
| 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 16 | |
| 17 | /** |
| 18 | * <!-- begin-user-doc --> |
| 19 | * An implementation of the model object '<em><b>Gamma Distribution</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.GammaDistributionImpl#getAlpha <em>Alpha</em>}</li> |
| 25 | * <li>{@link de.uka.ipd.sdq.probfunction.impl.GammaDistributionImpl#getTheta <em>Theta</em>}</li> |
| 26 | * </ul> |
| 27 | * </p> |
| 28 | * |
| 29 | * @generated |
| 30 | */ |
| 31 | public class GammaDistributionImpl extends ContinuousPDFImpl implements GammaDistribution { |
| 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 #getAlpha() <em>Alpha</em>}' attribute. |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @see #getAlpha() |
| 44 | * @generated |
| 45 | * @ordered |
| 46 | */ |
| 47 | protected static final double ALPHA_EDEFAULT = 0.0; |
| 48 | |
| 49 | /** |
| 50 | * The cached value of the '{@link #getAlpha() <em>Alpha</em>}' attribute. |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @see #getAlpha() |
| 54 | * @generated |
| 55 | * @ordered |
| 56 | */ |
| 57 | protected double alpha = ALPHA_EDEFAULT; |
| 58 | |
| 59 | /** |
| 60 | * The default value of the '{@link #getTheta() <em>Theta</em>}' attribute. |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @see #getTheta() |
| 64 | * @generated |
| 65 | * @ordered |
| 66 | */ |
| 67 | protected static final double THETA_EDEFAULT = 0.0; |
| 68 | |
| 69 | /** |
| 70 | * The cached value of the '{@link #getTheta() <em>Theta</em>}' attribute. |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @see #getTheta() |
| 74 | * @generated |
| 75 | * @ordered |
| 76 | */ |
| 77 | protected double theta = THETA_EDEFAULT; |
| 78 | |
| 79 | /** |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | protected GammaDistributionImpl() { |
| 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.GAMMA_DISTRIBUTION; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * <!-- begin-user-doc --> |
| 100 | * <!-- end-user-doc --> |
| 101 | * @generated |
| 102 | */ |
| 103 | public double getAlpha() { |
| 104 | return alpha; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * <!-- begin-user-doc --> |
| 109 | * <!-- end-user-doc --> |
| 110 | * @generated |
| 111 | */ |
| 112 | public void setAlpha(double newAlpha) { |
| 113 | double oldAlpha = alpha; |
| 114 | alpha = newAlpha; |
| 115 | if (eNotificationRequired()) |
| 116 | eNotify(new ENotificationImpl(this, Notification.SET, ProbfunctionPackage.GAMMA_DISTRIBUTION__ALPHA, oldAlpha, alpha)); |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * <!-- begin-user-doc --> |
| 121 | * <!-- end-user-doc --> |
| 122 | * @generated |
| 123 | */ |
| 124 | public double getTheta() { |
| 125 | return theta; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | public void setTheta(double newTheta) { |
| 134 | double oldTheta = theta; |
| 135 | theta = newTheta; |
| 136 | if (eNotificationRequired()) |
| 137 | eNotify(new ENotificationImpl(this, Notification.SET, ProbfunctionPackage.GAMMA_DISTRIBUTION__THETA, oldTheta, theta)); |
| 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.GAMMA_DISTRIBUTION__ALPHA: |
| 149 | return getAlpha(); |
| 150 | case ProbfunctionPackage.GAMMA_DISTRIBUTION__THETA: |
| 151 | return getTheta(); |
| 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.GAMMA_DISTRIBUTION__ALPHA: |
| 165 | setAlpha((Double)newValue); |
| 166 | return; |
| 167 | case ProbfunctionPackage.GAMMA_DISTRIBUTION__THETA: |
| 168 | setTheta((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.GAMMA_DISTRIBUTION__ALPHA: |
| 183 | setAlpha(ALPHA_EDEFAULT); |
| 184 | return; |
| 185 | case ProbfunctionPackage.GAMMA_DISTRIBUTION__THETA: |
| 186 | setTheta(THETA_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.GAMMA_DISTRIBUTION__ALPHA: |
| 201 | return alpha != ALPHA_EDEFAULT; |
| 202 | case ProbfunctionPackage.GAMMA_DISTRIBUTION__THETA: |
| 203 | return theta != THETA_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(" (alpha: "); |
| 219 | result.append(alpha); |
| 220 | result.append(", theta: "); |
| 221 | result.append(theta); |
| 222 | result.append(')'); |
| 223 | return result.toString(); |
| 224 | } |
| 225 | |
| 226 | } //GammaDistributionImpl |