| /** |
| */ |
| package org.eclipse.qvtd.doc.miniocl.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| |
| import org.eclipse.qvtd.doc.miniocl.CollectionKind; |
| import org.eclipse.qvtd.doc.miniocl.CollectionLiteralExp; |
| import org.eclipse.qvtd.doc.miniocl.CollectionLiteralPart; |
| import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage; |
| |
| import org.eclipse.qvtd.doc.miniocl.util.Visitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Collection Literal Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.doc.miniocl.impl.CollectionLiteralExpImpl#getOwnedParts <em>Owned Parts</em>}</li> |
| * <li>{@link org.eclipse.qvtd.doc.miniocl.impl.CollectionLiteralExpImpl#getKind <em>Kind</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CollectionLiteralExpImpl extends LiteralExpImpl implements CollectionLiteralExp { |
| /** |
| * The cached value of the '{@link #getOwnedParts() <em>Owned Parts</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedParts() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CollectionLiteralPart> ownedParts; |
| |
| /** |
| * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected static final CollectionKind KIND_EDEFAULT = CollectionKind.COLLECTION; |
| |
| /** |
| * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected CollectionKind kind = KIND_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CollectionLiteralExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MiniOCLPackage.Literals.COLLECTION_LITERAL_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<CollectionLiteralPart> getOwnedParts() { |
| if (ownedParts == null) { |
| ownedParts = new EObjectContainmentEList<CollectionLiteralPart>(CollectionLiteralPart.class, this, MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS); |
| } |
| return ownedParts; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CollectionKind getKind() { |
| return kind; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKind(CollectionKind newKind) { |
| CollectionKind oldKind = kind; |
| kind = newKind == null ? KIND_EDEFAULT : newKind; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.COLLECTION_LITERAL_EXP__KIND, oldKind, kind)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS: |
| return ((InternalEList<?>)getOwnedParts()).basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS: |
| return getOwnedParts(); |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__KIND: |
| return getKind(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS: |
| getOwnedParts().clear(); |
| getOwnedParts().addAll((Collection<? extends CollectionLiteralPart>)newValue); |
| return; |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__KIND: |
| setKind((CollectionKind)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS: |
| getOwnedParts().clear(); |
| return; |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__KIND: |
| setKind(KIND_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__OWNED_PARTS: |
| return ownedParts != null && !ownedParts.isEmpty(); |
| case MiniOCLPackage.COLLECTION_LITERAL_EXP__KIND: |
| return kind != KIND_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (kind: "); |
| result.append(kind); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitCollectionLiteralExp(this); |
| } |
| |
| } //CollectionLiteralExpImpl |