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