| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.stoex.impl; |
| 8 | |
| 9 | import org.eclipse.emf.common.notify.Notification; |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.InternalEObject; |
| 12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 13 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 14 | |
| 15 | import de.uka.ipd.sdq.stoex.Expression; |
| 16 | import de.uka.ipd.sdq.stoex.RandomVariable; |
| 17 | import de.uka.ipd.sdq.stoex.StoexPackage; |
| 18 | |
| 19 | /** |
| 20 | * <!-- begin-user-doc --> |
| 21 | * An implementation of the model object '<em><b>Random Variable</b></em>'. |
| 22 | * <!-- end-user-doc --> |
| 23 | * <p> |
| 24 | * The following features are implemented: |
| 25 | * <ul> |
| 26 | * <li>{@link de.uka.ipd.sdq.stoex.impl.RandomVariableImpl#getSpecification <em>Specification</em>}</li> |
| 27 | * <li>{@link de.uka.ipd.sdq.stoex.impl.RandomVariableImpl#getExpression <em>Expression</em>}</li> |
| 28 | * </ul> |
| 29 | * </p> |
| 30 | * |
| 31 | * @generated |
| 32 | */ |
| 33 | public class RandomVariableImpl extends EObjectImpl implements RandomVariable { |
| 34 | /** |
| 35 | * <!-- begin-user-doc --> |
| 36 | * <!-- end-user-doc --> |
| 37 | * @generated |
| 38 | */ |
| 39 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 40 | |
| 41 | /** |
| 42 | * The default value of the '{@link #getSpecification() <em>Specification</em>}' attribute. |
| 43 | * <!-- begin-user-doc --> |
| 44 | * <!-- end-user-doc --> |
| 45 | * @see #getSpecification() |
| 46 | * @generated |
| 47 | * @ordered |
| 48 | */ |
| 49 | protected static final String SPECIFICATION_EDEFAULT = null; |
| 50 | |
| 51 | /** |
| 52 | * The cached value of the '{@link #getSpecification() <em>Specification</em>}' attribute. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @see #getSpecification() |
| 56 | * @generated |
| 57 | * @ordered |
| 58 | */ |
| 59 | protected String specification = SPECIFICATION_EDEFAULT; |
| 60 | |
| 61 | /** |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | protected RandomVariableImpl() { |
| 67 | super(); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @generated |
| 74 | */ |
| 75 | @Override |
| 76 | protected EClass eStaticClass() { |
| 77 | return StoexPackage.Literals.RANDOM_VARIABLE; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | public String getSpecification() { |
| 86 | return specification; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | public void setSpecification(String newSpecification) { |
| 95 | String oldSpecification = specification; |
| 96 | specification = newSpecification; |
| 97 | if (eNotificationRequired()) |
| 98 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.RANDOM_VARIABLE__SPECIFICATION, oldSpecification, specification)); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @generated |
| 105 | */ |
| 106 | public Expression getExpression() { |
| 107 | Expression expression = basicGetExpression(); |
| 108 | return expression != null && expression.eIsProxy() ? (Expression)eResolveProxy((InternalEObject)expression) : expression; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * <!-- begin-user-doc --> |
| 113 | * <!-- end-user-doc --> |
| 114 | * @generated not |
| 115 | */ |
| 116 | public Expression basicGetExpression() { |
| 117 | // TODO: implement this method to return the 'Expression' reference |
| 118 | // -> do not perform proxy resolution |
| 119 | // Ensure that you remove @generated or mark it @generated NOT |
| 120 | return null; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated not |
| 127 | */ |
| 128 | public boolean isSetExpression() { |
| 129 | |
| 130 | return (this.getSpecification() != null); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | @Override |
| 139 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 140 | switch (featureID) { |
| 141 | case StoexPackage.RANDOM_VARIABLE__SPECIFICATION: |
| 142 | return getSpecification(); |
| 143 | case StoexPackage.RANDOM_VARIABLE__EXPRESSION: |
| 144 | if (resolve) return getExpression(); |
| 145 | return basicGetExpression(); |
| 146 | } |
| 147 | return super.eGet(featureID, resolve, coreType); |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * <!-- begin-user-doc --> |
| 152 | * <!-- end-user-doc --> |
| 153 | * @generated |
| 154 | */ |
| 155 | @Override |
| 156 | public void eSet(int featureID, Object newValue) { |
| 157 | switch (featureID) { |
| 158 | case StoexPackage.RANDOM_VARIABLE__SPECIFICATION: |
| 159 | setSpecification((String)newValue); |
| 160 | return; |
| 161 | } |
| 162 | super.eSet(featureID, newValue); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * <!-- begin-user-doc --> |
| 167 | * <!-- end-user-doc --> |
| 168 | * @generated |
| 169 | */ |
| 170 | @Override |
| 171 | public void eUnset(int featureID) { |
| 172 | switch (featureID) { |
| 173 | case StoexPackage.RANDOM_VARIABLE__SPECIFICATION: |
| 174 | setSpecification(SPECIFICATION_EDEFAULT); |
| 175 | return; |
| 176 | } |
| 177 | super.eUnset(featureID); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * <!-- begin-user-doc --> |
| 182 | * <!-- end-user-doc --> |
| 183 | * @generated |
| 184 | */ |
| 185 | @Override |
| 186 | public boolean eIsSet(int featureID) { |
| 187 | switch (featureID) { |
| 188 | case StoexPackage.RANDOM_VARIABLE__SPECIFICATION: |
| 189 | return SPECIFICATION_EDEFAULT == null ? specification != null : !SPECIFICATION_EDEFAULT.equals(specification); |
| 190 | case StoexPackage.RANDOM_VARIABLE__EXPRESSION: |
| 191 | return isSetExpression(); |
| 192 | } |
| 193 | return super.eIsSet(featureID); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * <!-- begin-user-doc --> |
| 198 | * <!-- end-user-doc --> |
| 199 | * @generated |
| 200 | */ |
| 201 | @Override |
| 202 | public String toString() { |
| 203 | if (eIsProxy()) return super.toString(); |
| 204 | |
| 205 | StringBuffer result = new StringBuffer(super.toString()); |
| 206 | result.append(" (specification: "); |
| 207 | result.append(specification); |
| 208 | result.append(')'); |
| 209 | return result.toString(); |
| 210 | } |
| 211 | |
| 212 | } //RandomVariableImpl |