| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTBase.impl; |
| 8 | |
| 9 | import EMOF.impl.ElementImpl; |
| 10 | |
| 11 | import EssentialOCL.Variable; |
| 12 | |
| 13 | import QVTBase.Pattern; |
| 14 | import QVTBase.Predicate; |
| 15 | import QVTBase.QVTBasePackage; |
| 16 | |
| 17 | import java.util.Collection; |
| 18 | |
| 19 | import org.eclipse.emf.common.notify.NotificationChain; |
| 20 | |
| 21 | import org.eclipse.emf.common.util.EList; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.EClass; |
| 24 | import org.eclipse.emf.ecore.InternalEObject; |
| 25 | |
| 26 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 27 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| 28 | import org.eclipse.emf.ecore.util.InternalEList; |
| 29 | |
| 30 | /** |
| 31 | * <!-- begin-user-doc --> |
| 32 | * An implementation of the model object '<em><b>Pattern</b></em>'. |
| 33 | * <!-- end-user-doc --> |
| 34 | * <p> |
| 35 | * The following features are implemented: |
| 36 | * <ul> |
| 37 | * <li>{@link QVTBase.impl.PatternImpl#getBindsTo <em>Binds To</em>}</li> |
| 38 | * <li>{@link QVTBase.impl.PatternImpl#getPredicate <em>Predicate</em>}</li> |
| 39 | * </ul> |
| 40 | * </p> |
| 41 | * |
| 42 | * @generated |
| 43 | */ |
| 44 | public class PatternImpl extends ElementImpl implements Pattern { |
| 45 | /** |
| 46 | * The cached value of the '{@link #getBindsTo() <em>Binds To</em>}' reference list. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @see #getBindsTo() |
| 50 | * @generated |
| 51 | * @ordered |
| 52 | */ |
| 53 | protected EList<Variable> bindsTo; |
| 54 | |
| 55 | /** |
| 56 | * The cached value of the '{@link #getPredicate() <em>Predicate</em>}' containment reference list. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @see #getPredicate() |
| 60 | * @generated |
| 61 | * @ordered |
| 62 | */ |
| 63 | protected EList<Predicate> predicate; |
| 64 | |
| 65 | /** |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | protected PatternImpl() { |
| 71 | super(); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | @Override |
| 80 | protected EClass eStaticClass() { |
| 81 | return QVTBasePackage.Literals.PATTERN; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | public EList<Variable> getBindsTo() { |
| 90 | if (bindsTo == null) { |
| 91 | bindsTo = new EObjectResolvingEList<Variable>(Variable.class, this, QVTBasePackage.PATTERN__BINDS_TO); |
| 92 | } |
| 93 | return bindsTo; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | public EList<Predicate> getPredicate() { |
| 102 | if (predicate == null) { |
| 103 | predicate = new EObjectContainmentWithInverseEList<Predicate>(Predicate.class, this, QVTBasePackage.PATTERN__PREDICATE, QVTBasePackage.PREDICATE__PATTERN); |
| 104 | } |
| 105 | return predicate; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | @SuppressWarnings("unchecked") |
| 114 | @Override |
| 115 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 116 | switch (featureID) { |
| 117 | case QVTBasePackage.PATTERN__PREDICATE: |
| 118 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getPredicate()).basicAdd(otherEnd, msgs); |
| 119 | } |
| 120 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | @Override |
| 129 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 130 | switch (featureID) { |
| 131 | case QVTBasePackage.PATTERN__PREDICATE: |
| 132 | return ((InternalEList<?>)getPredicate()).basicRemove(otherEnd, msgs); |
| 133 | } |
| 134 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * <!-- begin-user-doc --> |
| 139 | * <!-- end-user-doc --> |
| 140 | * @generated |
| 141 | */ |
| 142 | @Override |
| 143 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 144 | switch (featureID) { |
| 145 | case QVTBasePackage.PATTERN__BINDS_TO: |
| 146 | return getBindsTo(); |
| 147 | case QVTBasePackage.PATTERN__PREDICATE: |
| 148 | return getPredicate(); |
| 149 | } |
| 150 | return super.eGet(featureID, resolve, coreType); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | @SuppressWarnings("unchecked") |
| 159 | @Override |
| 160 | public void eSet(int featureID, Object newValue) { |
| 161 | switch (featureID) { |
| 162 | case QVTBasePackage.PATTERN__BINDS_TO: |
| 163 | getBindsTo().clear(); |
| 164 | getBindsTo().addAll((Collection<? extends Variable>)newValue); |
| 165 | return; |
| 166 | case QVTBasePackage.PATTERN__PREDICATE: |
| 167 | getPredicate().clear(); |
| 168 | getPredicate().addAll((Collection<? extends Predicate>)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 QVTBasePackage.PATTERN__BINDS_TO: |
| 183 | getBindsTo().clear(); |
| 184 | return; |
| 185 | case QVTBasePackage.PATTERN__PREDICATE: |
| 186 | getPredicate().clear(); |
| 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 QVTBasePackage.PATTERN__BINDS_TO: |
| 201 | return bindsTo != null && !bindsTo.isEmpty(); |
| 202 | case QVTBasePackage.PATTERN__PREDICATE: |
| 203 | return predicate != null && !predicate.isEmpty(); |
| 204 | } |
| 205 | return super.eIsSet(featureID); |
| 206 | } |
| 207 | |
| 208 | } //PatternImpl |