| /** |
| * Copyright (c) 2010, 2020 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - Initial API and implementation |
| */ |
| package org.eclipse.qvtd.xtext.qvtbasecs.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| 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.EObjectResolvingEList; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl; |
| |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| import org.eclipse.qvtd.pivot.qvtbase.TypedModel; |
| |
| import org.eclipse.qvtd.xtext.qvtbasecs.QVTbaseCSPackage; |
| import org.eclipse.qvtd.xtext.qvtbasecs.SimpleTargetElementCS; |
| import org.eclipse.qvtd.xtext.qvtbasecs.util.QVTbaseCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Simple Target Element CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.SimpleTargetElementCSImpl#getTypedModel <em>Typed Model</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.SimpleTargetElementCSImpl#getIterates <em>Iterates</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.SimpleTargetElementCSImpl#getInput <em>Input</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.SimpleTargetElementCSImpl#getOutput <em>Output</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.SimpleTargetElementCSImpl#getVia <em>Via</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SimpleTargetElementCSImpl extends TargetElementCSImpl implements SimpleTargetElementCS |
| { |
| /** |
| * The number of structural features of the '<em>Simple Target Element CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int SIMPLE_TARGET_ELEMENT_CS_FEATURE_COUNT = TargetElementCSImpl.TARGET_ELEMENT_CS_FEATURE_COUNT + 5; |
| |
| |
| /** |
| * The cached value of the '{@link #getTypedModel() <em>Typed Model</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTypedModel() |
| * @generated |
| * @ordered |
| */ |
| protected TypedModel typedModel; |
| |
| /** |
| * The cached value of the '{@link #getIterates() <em>Iterates</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIterates() |
| * @generated |
| * @ordered |
| */ |
| protected EList<TypedModel> iterates; |
| |
| /** |
| * The default value of the '{@link #getInput() <em>Input</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getInput() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean INPUT_EDEFAULT = null; |
| |
| |
| /** |
| * The cached value of the '{@link #getInput() <em>Input</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getInput() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean input = INPUT_EDEFAULT; |
| |
| |
| /** |
| * The default value of the '{@link #getOutput() <em>Output</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOutput() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean OUTPUT_EDEFAULT = null; |
| |
| |
| /** |
| * The cached value of the '{@link #getOutput() <em>Output</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOutput() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean output = OUTPUT_EDEFAULT; |
| |
| |
| /** |
| * The default value of the '{@link #getVia() <em>Via</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVia() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean VIA_EDEFAULT = null; |
| |
| |
| /** |
| * The cached value of the '{@link #getVia() <em>Via</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVia() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean via = VIA_EDEFAULT; |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SimpleTargetElementCSImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return QVTbaseCSPackage.Literals.SIMPLE_TARGET_ELEMENT_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public TypedModel getTypedModel() |
| { |
| if (typedModel != null && typedModel.eIsProxy()) |
| { |
| InternalEObject oldTypedModel = (InternalEObject)typedModel; |
| typedModel = (TypedModel)eResolveProxy(oldTypedModel); |
| if (typedModel != oldTypedModel) |
| { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, oldTypedModel, typedModel)); |
| } |
| } |
| return typedModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TypedModel basicGetTypedModel() |
| { |
| return typedModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setTypedModel(TypedModel newTypedModel) |
| { |
| TypedModel oldTypedModel = typedModel; |
| typedModel = newTypedModel; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, oldTypedModel, typedModel)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<TypedModel> getIterates() |
| { |
| if (iterates == null) |
| { |
| iterates = new EObjectResolvingEList<TypedModel>(TypedModel.class, this, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1); |
| } |
| return iterates; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Boolean getInput() |
| { |
| return input; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setInput(Boolean newInput) |
| { |
| Boolean oldInput = input; |
| input = newInput; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, oldInput, input)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Boolean getOutput() |
| { |
| return output; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOutput(Boolean newOutput) |
| { |
| Boolean oldOutput = output; |
| output = newOutput; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, oldOutput, output)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Boolean getVia() |
| { |
| return via; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setVia(Boolean newVia) |
| { |
| Boolean oldVia = via; |
| via = newVia; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4, oldVia, via)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| if (resolve) return getTypedModel(); |
| return basicGetTypedModel(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| return getIterates(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| return getInput(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| return getOutput(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4: |
| return getVia(); |
| } |
| 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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| setTypedModel((TypedModel)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| getIterates().clear(); |
| getIterates().addAll((Collection<? extends TypedModel>)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| setInput((Boolean)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| setOutput((Boolean)newValue); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4: |
| setVia((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| setTypedModel((TypedModel)null); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| getIterates().clear(); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| setInput(INPUT_EDEFAULT); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| setOutput(OUTPUT_EDEFAULT); |
| return; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4: |
| setVia(VIA_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0: |
| return typedModel != null; |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1: |
| return iterates != null && !iterates.isEmpty(); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2: |
| return INPUT_EDEFAULT == null ? input != null : !INPUT_EDEFAULT.equals(input); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3: |
| return OUTPUT_EDEFAULT == null ? output != null : !OUTPUT_EDEFAULT.equals(output); |
| case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4: |
| return VIA_EDEFAULT == null ? via != null : !VIA_EDEFAULT.equals(via); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() |
| { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (input: "); |
| result.append(input); |
| result.append(", output: "); |
| result.append(output); |
| result.append(", via: "); |
| result.append(via); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(@NonNull BaseCSVisitor<R> visitor) { |
| if (visitor instanceof QVTbaseCSVisitor) { |
| return (R) ((QVTbaseCSVisitor<?>)visitor).visitSimpleTargetElementCS(this); |
| } |
| else { |
| return super.accept(visitor); |
| } |
| } |
| |
| |
| } //SimpleTargetElementCSImpl |