/** | |
* Copyright (c) 2020 CEA LIST. | |
* | |
* 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\n\nContributors: | |
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr | |
* - Initial API and Implementation | |
*/ | |
package org.eclipse.efm.ecore.formalml.datatype.impl; | |
import org.eclipse.efm.ecore.formalml.common.NamedElement; | |
import org.eclipse.efm.ecore.formalml.datatype.DatatypePackage; | |
import org.eclipse.efm.ecore.formalml.datatype.PrimitiveInstanceKind; | |
import org.eclipse.efm.ecore.formalml.datatype.PrimitiveInstanceType; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Primitive Instance Type</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.efm.ecore.formalml.datatype.impl.PrimitiveInstanceTypeImpl#getExpected <em>Expected</em>}</li> | |
* <li>{@link org.eclipse.efm.ecore.formalml.datatype.impl.PrimitiveInstanceTypeImpl#getModel <em>Model</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class PrimitiveInstanceTypeImpl extends PrimitiveTypeImpl implements PrimitiveInstanceType { | |
/** | |
* The default value of the '{@link #getExpected() <em>Expected</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getExpected() | |
* @generated | |
* @ordered | |
*/ | |
protected static final PrimitiveInstanceKind EXPECTED_EDEFAULT = PrimitiveInstanceKind.MACHINE; | |
/** | |
* The cached value of the '{@link #getExpected() <em>Expected</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getExpected() | |
* @generated | |
* @ordered | |
*/ | |
protected PrimitiveInstanceKind expected = EXPECTED_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getModel() <em>Model</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getModel() | |
* @generated | |
* @ordered | |
*/ | |
protected NamedElement model; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected PrimitiveInstanceTypeImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return DatatypePackage.Literals.PRIMITIVE_INSTANCE_TYPE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public PrimitiveInstanceKind getExpected() { | |
return expected; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setExpected(PrimitiveInstanceKind newExpected) { | |
PrimitiveInstanceKind oldExpected = expected; | |
expected = newExpected == null ? EXPECTED_EDEFAULT : newExpected; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, DatatypePackage.PRIMITIVE_INSTANCE_TYPE__EXPECTED, oldExpected, expected)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NamedElement getModel() { | |
if (model != null && model.eIsProxy()) { | |
InternalEObject oldModel = (InternalEObject)model; | |
model = (NamedElement)eResolveProxy(oldModel); | |
if (model != oldModel) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL, oldModel, model)); | |
} | |
} | |
return model; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NamedElement basicGetModel() { | |
return model; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setModel(NamedElement newModel) { | |
NamedElement oldModel = model; | |
model = newModel; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL, oldModel, model)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__EXPECTED: | |
return getExpected(); | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL: | |
if (resolve) return getModel(); | |
return basicGetModel(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__EXPECTED: | |
setExpected((PrimitiveInstanceKind)newValue); | |
return; | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL: | |
setModel((NamedElement)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__EXPECTED: | |
setExpected(EXPECTED_EDEFAULT); | |
return; | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL: | |
setModel((NamedElement)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__EXPECTED: | |
return expected != EXPECTED_EDEFAULT; | |
case DatatypePackage.PRIMITIVE_INSTANCE_TYPE__MODEL: | |
return model != null; | |
} | |
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(" (expected: "); | |
result.append(expected); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //PrimitiveInstanceTypeImpl |