| /** |
| * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH 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: |
| * EclipseSource Munich - initial API and implementation |
| */ |
| package org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.D; |
| import org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.DPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>D</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.impl.DImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.impl.DImpl#getAtts <em>Atts</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.migration.edapt.test.model.d.model.impl.DImpl#getRefs <em>Refs</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class DImpl extends MinimalEObjectImpl.Container implements D { |
| /** |
| * 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 #getAtts() <em>Atts</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getAtts() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> atts; |
| |
| /** |
| * The cached value of the '{@link #getRefs() <em>Refs</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getRefs() |
| * @generated |
| * @ordered |
| */ |
| protected EList<D> refs; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected DImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DPackage.Literals.D; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setName(String newName) { |
| final String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, DPackage.D__NAME, oldName, name)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EList<String> getAtts() { |
| if (atts == null) { |
| atts = new EDataTypeUniqueEList<String>(String.class, this, DPackage.D__ATTS); |
| } |
| return atts; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EList<D> getRefs() { |
| if (refs == null) { |
| refs = new EObjectResolvingEList<D>(D.class, this, DPackage.D__REFS); |
| } |
| return refs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case DPackage.D__NAME: |
| return getName(); |
| case DPackage.D__ATTS: |
| return getAtts(); |
| case DPackage.D__REFS: |
| return getRefs(); |
| } |
| 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 DPackage.D__NAME: |
| setName((String) newValue); |
| return; |
| case DPackage.D__ATTS: |
| getAtts().clear(); |
| getAtts().addAll((Collection<? extends String>) newValue); |
| return; |
| case DPackage.D__REFS: |
| getRefs().clear(); |
| getRefs().addAll((Collection<? extends D>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DPackage.D__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case DPackage.D__ATTS: |
| getAtts().clear(); |
| return; |
| case DPackage.D__REFS: |
| getRefs().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DPackage.D__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case DPackage.D__ATTS: |
| return atts != null && !atts.isEmpty(); |
| case DPackage.D__REFS: |
| return refs != null && !refs.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) { |
| return super.toString(); |
| } |
| |
| final StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); |
| result.append(name); |
| result.append(", atts: "); |
| result.append(atts); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // DImpl |