| /******************************************************************************* |
| * Copyright (c) 2015 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.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.EObjectWithInverseResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.ElementStatus; |
| import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.EvaluationStatusPackage; |
| import org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.MappingStatus; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Element Status</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.impl.ElementStatusImpl#getDepth <em>Depth</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.impl.ElementStatusImpl#getSources <em>Sources</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.evaluationstatus.impl.ElementStatusImpl#getTargets <em>Targets</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class ElementStatusImpl extends EvaluationElementImpl implements ElementStatus { |
| /** |
| * The default value of the '{@link #getDepth() <em>Depth</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDepth() |
| * @generated |
| * @ordered |
| */ |
| protected static final Integer DEPTH_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDepth() <em>Depth</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDepth() |
| * @generated |
| * @ordered |
| */ |
| protected Integer depth = DEPTH_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getSources() <em>Sources</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSources() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MappingStatus> sources; |
| |
| /** |
| * The cached value of the '{@link #getTargets() <em>Targets</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargets() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MappingStatus> targets; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ElementStatusImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EvaluationStatusPackage.Literals.ELEMENT_STATUS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Integer getDepth() { |
| return depth; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDepth(Integer newDepth) { |
| Integer oldDepth = depth; |
| depth = newDepth; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EvaluationStatusPackage.ELEMENT_STATUS__DEPTH, oldDepth, depth)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MappingStatus> getSources() { |
| if (sources == null) { |
| sources = new EObjectWithInverseResolvingEList.ManyInverse<MappingStatus>(MappingStatus.class, this, EvaluationStatusPackage.ELEMENT_STATUS__SOURCES, EvaluationStatusPackage.MAPPING_STATUS__OUTPUTS); |
| } |
| return sources; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MappingStatus> getTargets() { |
| if (targets == null) { |
| targets = new EObjectWithInverseResolvingEList.ManyInverse<MappingStatus>(MappingStatus.class, this, EvaluationStatusPackage.ELEMENT_STATUS__TARGETS, EvaluationStatusPackage.MAPPING_STATUS__INPUTS); |
| } |
| return targets; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getSources()).basicAdd(otherEnd, msgs); |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getTargets()).basicAdd(otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| return ((InternalEList<?>)getSources()).basicRemove(otherEnd, msgs); |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| return ((InternalEList<?>)getTargets()).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 EvaluationStatusPackage.ELEMENT_STATUS__DEPTH: |
| return getDepth(); |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| return getSources(); |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| return getTargets(); |
| } |
| 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 EvaluationStatusPackage.ELEMENT_STATUS__DEPTH: |
| setDepth((Integer)newValue); |
| return; |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| getSources().clear(); |
| getSources().addAll((Collection<? extends MappingStatus>)newValue); |
| return; |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| getTargets().clear(); |
| getTargets().addAll((Collection<? extends MappingStatus>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EvaluationStatusPackage.ELEMENT_STATUS__DEPTH: |
| setDepth(DEPTH_EDEFAULT); |
| return; |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| getSources().clear(); |
| return; |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| getTargets().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EvaluationStatusPackage.ELEMENT_STATUS__DEPTH: |
| return DEPTH_EDEFAULT == null ? depth != null : !DEPTH_EDEFAULT.equals(depth); |
| case EvaluationStatusPackage.ELEMENT_STATUS__SOURCES: |
| return sources != null && !sources.isEmpty(); |
| case EvaluationStatusPackage.ELEMENT_STATUS__TARGETS: |
| return targets != null && !targets.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| |
| } //ElementStatusImpl |