| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package LqnCore.impl; |
| 8 | |
| 9 | import LqnCore.ActivityType; |
| 10 | import LqnCore.AndJoinListType; |
| 11 | import LqnCore.LqnCorePackage; |
| 12 | |
| 13 | import java.math.BigInteger; |
| 14 | |
| 15 | import java.util.Collection; |
| 16 | |
| 17 | import org.eclipse.emf.common.notify.Notification; |
| 18 | import org.eclipse.emf.common.notify.NotificationChain; |
| 19 | |
| 20 | import org.eclipse.emf.common.util.EList; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.EClass; |
| 23 | import org.eclipse.emf.ecore.InternalEObject; |
| 24 | |
| 25 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 26 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 27 | |
| 28 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 29 | import org.eclipse.emf.ecore.util.InternalEList; |
| 30 | |
| 31 | /** |
| 32 | * <!-- begin-user-doc --> |
| 33 | * An implementation of the model object '<em><b>And Join List Type</b></em>'. |
| 34 | * <!-- end-user-doc --> |
| 35 | * <p> |
| 36 | * The following features are implemented: |
| 37 | * <ul> |
| 38 | * <li>{@link LqnCore.impl.AndJoinListTypeImpl#getActivity <em>Activity</em>}</li> |
| 39 | * <li>{@link LqnCore.impl.AndJoinListTypeImpl#getQuorum <em>Quorum</em>}</li> |
| 40 | * </ul> |
| 41 | * </p> |
| 42 | * |
| 43 | * @generated |
| 44 | */ |
| 45 | public class AndJoinListTypeImpl extends EObjectImpl implements AndJoinListType { |
| 46 | /** |
| 47 | * The cached value of the '{@link #getActivity() <em>Activity</em>}' containment reference list. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @see #getActivity() |
| 51 | * @generated |
| 52 | * @ordered |
| 53 | */ |
| 54 | protected EList<ActivityType> activity; |
| 55 | |
| 56 | /** |
| 57 | * The default value of the '{@link #getQuorum() <em>Quorum</em>}' attribute. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @see #getQuorum() |
| 61 | * @generated |
| 62 | * @ordered |
| 63 | */ |
| 64 | protected static final BigInteger QUORUM_EDEFAULT = new BigInteger("0"); |
| 65 | |
| 66 | /** |
| 67 | * The cached value of the '{@link #getQuorum() <em>Quorum</em>}' attribute. |
| 68 | * <!-- begin-user-doc --> |
| 69 | * <!-- end-user-doc --> |
| 70 | * @see #getQuorum() |
| 71 | * @generated |
| 72 | * @ordered |
| 73 | */ |
| 74 | protected BigInteger quorum = QUORUM_EDEFAULT; |
| 75 | |
| 76 | /** |
| 77 | * This is true if the Quorum attribute has been set. |
| 78 | * <!-- begin-user-doc --> |
| 79 | * <!-- end-user-doc --> |
| 80 | * @generated |
| 81 | * @ordered |
| 82 | */ |
| 83 | protected boolean quorumESet; |
| 84 | |
| 85 | /** |
| 86 | * <!-- begin-user-doc --> |
| 87 | * <!-- end-user-doc --> |
| 88 | * @generated |
| 89 | */ |
| 90 | protected AndJoinListTypeImpl() { |
| 91 | super(); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * <!-- begin-user-doc --> |
| 96 | * <!-- end-user-doc --> |
| 97 | * @generated |
| 98 | */ |
| 99 | @Override |
| 100 | protected EClass eStaticClass() { |
| 101 | return LqnCorePackage.Literals.AND_JOIN_LIST_TYPE; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @generated |
| 108 | */ |
| 109 | public EList<ActivityType> getActivity() { |
| 110 | if (activity == null) { |
| 111 | activity = new EObjectContainmentEList<ActivityType>(ActivityType.class, this, LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY); |
| 112 | } |
| 113 | return activity; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * <!-- begin-user-doc --> |
| 118 | * <!-- end-user-doc --> |
| 119 | * @generated |
| 120 | */ |
| 121 | public BigInteger getQuorum() { |
| 122 | return quorum; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * <!-- begin-user-doc --> |
| 127 | * <!-- end-user-doc --> |
| 128 | * @generated |
| 129 | */ |
| 130 | public void setQuorum(BigInteger newQuorum) { |
| 131 | BigInteger oldQuorum = quorum; |
| 132 | quorum = newQuorum; |
| 133 | boolean oldQuorumESet = quorumESet; |
| 134 | quorumESet = true; |
| 135 | if (eNotificationRequired()) |
| 136 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM, oldQuorum, quorum, !oldQuorumESet)); |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * <!-- begin-user-doc --> |
| 141 | * <!-- end-user-doc --> |
| 142 | * @generated |
| 143 | */ |
| 144 | public void unsetQuorum() { |
| 145 | BigInteger oldQuorum = quorum; |
| 146 | boolean oldQuorumESet = quorumESet; |
| 147 | quorum = QUORUM_EDEFAULT; |
| 148 | quorumESet = false; |
| 149 | if (eNotificationRequired()) |
| 150 | eNotify(new ENotificationImpl(this, Notification.UNSET, LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM, oldQuorum, QUORUM_EDEFAULT, oldQuorumESet)); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | public boolean isSetQuorum() { |
| 159 | return quorumESet; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * <!-- begin-user-doc --> |
| 164 | * <!-- end-user-doc --> |
| 165 | * @generated |
| 166 | */ |
| 167 | @Override |
| 168 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 169 | switch (featureID) { |
| 170 | case LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY: |
| 171 | return ((InternalEList<?>)getActivity()).basicRemove(otherEnd, msgs); |
| 172 | } |
| 173 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * <!-- begin-user-doc --> |
| 178 | * <!-- end-user-doc --> |
| 179 | * @generated |
| 180 | */ |
| 181 | @Override |
| 182 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 183 | switch (featureID) { |
| 184 | case LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY: |
| 185 | return getActivity(); |
| 186 | case LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM: |
| 187 | return getQuorum(); |
| 188 | } |
| 189 | return super.eGet(featureID, resolve, coreType); |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * <!-- begin-user-doc --> |
| 194 | * <!-- end-user-doc --> |
| 195 | * @generated |
| 196 | */ |
| 197 | @SuppressWarnings("unchecked") |
| 198 | @Override |
| 199 | public void eSet(int featureID, Object newValue) { |
| 200 | switch (featureID) { |
| 201 | case LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY: |
| 202 | getActivity().clear(); |
| 203 | getActivity().addAll((Collection<? extends ActivityType>)newValue); |
| 204 | return; |
| 205 | case LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM: |
| 206 | setQuorum((BigInteger)newValue); |
| 207 | return; |
| 208 | } |
| 209 | super.eSet(featureID, newValue); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * <!-- begin-user-doc --> |
| 214 | * <!-- end-user-doc --> |
| 215 | * @generated |
| 216 | */ |
| 217 | @Override |
| 218 | public void eUnset(int featureID) { |
| 219 | switch (featureID) { |
| 220 | case LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY: |
| 221 | getActivity().clear(); |
| 222 | return; |
| 223 | case LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM: |
| 224 | unsetQuorum(); |
| 225 | return; |
| 226 | } |
| 227 | super.eUnset(featureID); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * <!-- begin-user-doc --> |
| 232 | * <!-- end-user-doc --> |
| 233 | * @generated |
| 234 | */ |
| 235 | @Override |
| 236 | public boolean eIsSet(int featureID) { |
| 237 | switch (featureID) { |
| 238 | case LqnCorePackage.AND_JOIN_LIST_TYPE__ACTIVITY: |
| 239 | return activity != null && !activity.isEmpty(); |
| 240 | case LqnCorePackage.AND_JOIN_LIST_TYPE__QUORUM: |
| 241 | return isSetQuorum(); |
| 242 | } |
| 243 | return super.eIsSet(featureID); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * <!-- begin-user-doc --> |
| 248 | * <!-- end-user-doc --> |
| 249 | * @generated |
| 250 | */ |
| 251 | @Override |
| 252 | public String toString() { |
| 253 | if (eIsProxy()) return super.toString(); |
| 254 | |
| 255 | StringBuffer result = new StringBuffer(super.toString()); |
| 256 | result.append(" (quorum: "); |
| 257 | if (quorumESet) result.append(quorum); else result.append("<unset>"); |
| 258 | result.append(')'); |
| 259 | return result.toString(); |
| 260 | } |
| 261 | |
| 262 | } //AndJoinListTypeImpl |