| /** |
| * 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 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.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.osbp.xtext.entitymock.EntityMockDSLPackage; |
| import org.eclipse.osbp.xtext.entitymock.EntityMockObject; |
| import org.eclipse.osbp.xtext.entitymock.EntityMockObjectEnum; |
| import org.eclipse.osbp.xtext.entitymock.EntityMockObjectFunction; |
| import org.eclipse.osbp.xtext.entitymock.IEntityMockObjectAttribute; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Entity Mock Object</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectImpl#getEnumerations <em>Enumerations</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectImpl#getAttributes <em>Attributes</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectImpl#getCalculations <em>Calculations</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EntityMockObjectImpl extends MinimalEObjectImpl.Container implements EntityMockObject { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getEnumerations() <em>Enumerations</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEnumerations() |
| * @generated |
| * @ordered |
| */ |
| protected EList<EntityMockObjectEnum> enumerations; |
| |
| /** |
| * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<IEntityMockObjectAttribute> attributes; |
| |
| /** |
| * The cached value of the '{@link #getCalculations() <em>Calculations</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCalculations() |
| * @generated |
| * @ordered |
| */ |
| protected EList<EntityMockObjectFunction> calculations; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EntityMockObjectImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EntityMockDSLPackage.Literals.ENTITY_MOCK_OBJECT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_OBJECT__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<EntityMockObjectEnum> getEnumerations() { |
| if (enumerations == null) { |
| enumerations = new EObjectContainmentEList<EntityMockObjectEnum>(EntityMockObjectEnum.class, this, EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS); |
| } |
| return enumerations; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<IEntityMockObjectAttribute> getAttributes() { |
| if (attributes == null) { |
| attributes = new EObjectContainmentEList<IEntityMockObjectAttribute>(IEntityMockObjectAttribute.class, this, EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES); |
| } |
| return attributes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<EntityMockObjectFunction> getCalculations() { |
| if (calculations == null) { |
| calculations = new EObjectContainmentEList<EntityMockObjectFunction>(EntityMockObjectFunction.class, this, EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS); |
| } |
| return calculations; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS: |
| return ((InternalEList<?>)getEnumerations()).basicRemove(otherEnd, msgs); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES: |
| return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, msgs); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS: |
| return ((InternalEList<?>)getCalculations()).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 EntityMockDSLPackage.ENTITY_MOCK_OBJECT__NAME: |
| return getName(); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS: |
| return getEnumerations(); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES: |
| return getAttributes(); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS: |
| return getCalculations(); |
| } |
| 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 EntityMockDSLPackage.ENTITY_MOCK_OBJECT__NAME: |
| setName((String)newValue); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS: |
| getEnumerations().clear(); |
| getEnumerations().addAll((Collection<? extends EntityMockObjectEnum>)newValue); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES: |
| getAttributes().clear(); |
| getAttributes().addAll((Collection<? extends IEntityMockObjectAttribute>)newValue); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS: |
| getCalculations().clear(); |
| getCalculations().addAll((Collection<? extends EntityMockObjectFunction>)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_OBJECT__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS: |
| getEnumerations().clear(); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES: |
| getAttributes().clear(); |
| return; |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS: |
| getCalculations().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ENUMERATIONS: |
| return enumerations != null && !enumerations.isEmpty(); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__ATTRIBUTES: |
| return attributes != null && !attributes.isEmpty(); |
| case EntityMockDSLPackage.ENTITY_MOCK_OBJECT__CALCULATIONS: |
| return calculations != null && !calculations.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //EntityMockObjectImpl |