blob: 2e2ce6302de0a5d0efecc81191e267f5548d22b5 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.entitymock.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
import org.eclipse.osbp.xtext.entitymock.EntityMockDSLPackage;
import org.eclipse.osbp.xtext.entitymock.EntityMockEntityFunctionParameter;
import org.eclipse.osbp.xtext.entitymock.EntityMockEntityNestedAttribute;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Entity Mock Entity Function Parameter</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockEntityFunctionParameterImpl#getAttributeRef <em>Attribute Ref</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockEntityFunctionParameterImpl#getNestedAttribute <em>Nested Attribute</em>}</li>
* </ul>
*
* @generated
*/
public class EntityMockEntityFunctionParameterImpl extends MinimalEObjectImpl.Container implements EntityMockEntityFunctionParameter {
/**
* The cached value of the '{@link #getAttributeRef() <em>Attribute Ref</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeRef()
* @generated
* @ordered
*/
protected LEntityAttribute attributeRef;
/**
* The cached value of the '{@link #getNestedAttribute() <em>Nested Attribute</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNestedAttribute()
* @generated
* @ordered
*/
protected EntityMockEntityNestedAttribute nestedAttribute;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EntityMockEntityFunctionParameterImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityMockDSLPackage.Literals.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute getAttributeRef() {
if (attributeRef != null && attributeRef.eIsProxy()) {
InternalEObject oldAttributeRef = (InternalEObject)attributeRef;
attributeRef = (LEntityAttribute)eResolveProxy(oldAttributeRef);
if (attributeRef != oldAttributeRef) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF, oldAttributeRef, attributeRef));
}
}
return attributeRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute basicGetAttributeRef() {
return attributeRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttributeRef(LEntityAttribute newAttributeRef) {
LEntityAttribute oldAttributeRef = attributeRef;
attributeRef = newAttributeRef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF, oldAttributeRef, attributeRef));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockEntityNestedAttribute getNestedAttribute() {
return nestedAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetNestedAttribute(EntityMockEntityNestedAttribute newNestedAttribute, NotificationChain msgs) {
EntityMockEntityNestedAttribute oldNestedAttribute = nestedAttribute;
nestedAttribute = newNestedAttribute;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE, oldNestedAttribute, newNestedAttribute);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNestedAttribute(EntityMockEntityNestedAttribute newNestedAttribute) {
if (newNestedAttribute != nestedAttribute) {
NotificationChain msgs = null;
if (nestedAttribute != null)
msgs = ((InternalEObject)nestedAttribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE, null, msgs);
if (newNestedAttribute != null)
msgs = ((InternalEObject)newNestedAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE, null, msgs);
msgs = basicSetNestedAttribute(newNestedAttribute, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE, newNestedAttribute, newNestedAttribute));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE:
return basicSetNestedAttribute(null, 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 EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF:
if (resolve) return getAttributeRef();
return basicGetAttributeRef();
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE:
return getNestedAttribute();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF:
setAttributeRef((LEntityAttribute)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE:
setNestedAttribute((EntityMockEntityNestedAttribute)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF:
setAttributeRef((LEntityAttribute)null);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE:
setNestedAttribute((EntityMockEntityNestedAttribute)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__ATTRIBUTE_REF:
return attributeRef != null;
case EntityMockDSLPackage.ENTITY_MOCK_ENTITY_FUNCTION_PARAMETER__NESTED_ATTRIBUTE:
return nestedAttribute != null;
}
return super.eIsSet(featureID);
}
} //EntityMockEntityFunctionParameterImpl