blob: 66641e0b6a6b4a969a46af56db0ab258d9939451 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2015, 2018 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.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 number of structural features of the '<em>Element Status</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int ELEMENT_STATUS_FEATURE_COUNT = EvaluationElementImpl.EVALUATION_ELEMENT_FEATURE_COUNT + 3;
/**
* 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, 0, 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, 1, 5);
}
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, 2, 2);
}
return targets;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@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 1:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getSources()).basicAdd(otherEnd, msgs);
case 2:
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 1:
return ((InternalEList<?>)getSources()).basicRemove(otherEnd, msgs);
case 2:
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 0:
return getDepth();
case 1:
return getSources();
case 2:
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 0:
setDepth((Integer)newValue);
return;
case 1:
getSources().clear();
getSources().addAll((Collection<? extends MappingStatus>)newValue);
return;
case 2:
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 0:
setDepth(DEPTH_EDEFAULT);
return;
case 1:
getSources().clear();
return;
case 2:
getTargets().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case 0:
return DEPTH_EDEFAULT == null ? depth != null : !DEPTH_EDEFAULT.equals(depth);
case 1:
return sources != null && !sources.isEmpty();
case 2:
return targets != null && !targets.isEmpty();
}
return super.eIsSet(featureID);
}
} //ElementStatusImpl