| /** |
| * * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro |
| * * 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: |
| * * Istvan Rath, Daniel Varro - initial API and implementation |
| * |
| */ |
| package org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.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.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.DefinitionsPackage; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.ImportDeclaration; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Machine; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Module; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.NamespaceDefinition; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Module</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.ModuleImpl#getFileName <em>File Name</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.ModuleImpl#getMachine <em>Machine</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.ModuleImpl#getImport <em>Import</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.ModuleImpl#getNamespace <em>Namespace</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ModuleImpl extends GTASMElementImpl implements Module |
| { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n"; |
| |
| /** |
| * The default value of the '{@link #getFileName() <em>File Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFileName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String FILE_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getFileName() <em>File Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFileName() |
| * @generated |
| * @ordered |
| */ |
| protected String fileName = FILE_NAME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getMachine() <em>Machine</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMachine() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Machine> machine; |
| |
| /** |
| * The cached value of the '{@link #getImport() <em>Import</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImport() |
| * @generated |
| * @ordered |
| */ |
| protected EList<ImportDeclaration> import_; |
| |
| /** |
| * The cached value of the '{@link #getNamespace() <em>Namespace</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNamespace() |
| * @generated |
| * @ordered |
| */ |
| protected NamespaceDefinition namespace; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ModuleImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return DefinitionsPackage.Literals.MODULE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getFileName() |
| { |
| return fileName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFileName(String newFileName) |
| { |
| String oldFileName = fileName; |
| fileName = newFileName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.MODULE__FILE_NAME, oldFileName, fileName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Machine> getMachine() |
| { |
| if (machine == null) |
| { |
| machine = new EObjectContainmentWithInverseEList<Machine>(Machine.class, this, DefinitionsPackage.MODULE__MACHINE, DefinitionsPackage.MACHINE__MODULE); |
| } |
| return machine; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ImportDeclaration> getImport() |
| { |
| if (import_ == null) |
| { |
| import_ = new EObjectContainmentEList<ImportDeclaration>(ImportDeclaration.class, this, DefinitionsPackage.MODULE__IMPORT); |
| } |
| return import_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NamespaceDefinition getNamespace() |
| { |
| return namespace; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetNamespace(NamespaceDefinition newNamespace, NotificationChain msgs) |
| { |
| NamespaceDefinition oldNamespace = namespace; |
| namespace = newNamespace; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DefinitionsPackage.MODULE__NAMESPACE, oldNamespace, newNamespace); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setNamespace(NamespaceDefinition newNamespace) |
| { |
| if (newNamespace != namespace) |
| { |
| NotificationChain msgs = null; |
| if (namespace != null) |
| msgs = ((InternalEObject)namespace).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DefinitionsPackage.MODULE__NAMESPACE, null, msgs); |
| if (newNamespace != null) |
| msgs = ((InternalEObject)newNamespace).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DefinitionsPackage.MODULE__NAMESPACE, null, msgs); |
| msgs = basicSetNamespace(newNamespace, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.MODULE__NAMESPACE, newNamespace, newNamespace)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case DefinitionsPackage.MODULE__MACHINE: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getMachine()).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 DefinitionsPackage.MODULE__MACHINE: |
| return ((InternalEList<?>)getMachine()).basicRemove(otherEnd, msgs); |
| case DefinitionsPackage.MODULE__IMPORT: |
| return ((InternalEList<?>)getImport()).basicRemove(otherEnd, msgs); |
| case DefinitionsPackage.MODULE__NAMESPACE: |
| return basicSetNamespace(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 DefinitionsPackage.MODULE__FILE_NAME: |
| return getFileName(); |
| case DefinitionsPackage.MODULE__MACHINE: |
| return getMachine(); |
| case DefinitionsPackage.MODULE__IMPORT: |
| return getImport(); |
| case DefinitionsPackage.MODULE__NAMESPACE: |
| return getNamespace(); |
| } |
| 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 DefinitionsPackage.MODULE__FILE_NAME: |
| setFileName((String)newValue); |
| return; |
| case DefinitionsPackage.MODULE__MACHINE: |
| getMachine().clear(); |
| getMachine().addAll((Collection<? extends Machine>)newValue); |
| return; |
| case DefinitionsPackage.MODULE__IMPORT: |
| getImport().clear(); |
| getImport().addAll((Collection<? extends ImportDeclaration>)newValue); |
| return; |
| case DefinitionsPackage.MODULE__NAMESPACE: |
| setNamespace((NamespaceDefinition)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case DefinitionsPackage.MODULE__FILE_NAME: |
| setFileName(FILE_NAME_EDEFAULT); |
| return; |
| case DefinitionsPackage.MODULE__MACHINE: |
| getMachine().clear(); |
| return; |
| case DefinitionsPackage.MODULE__IMPORT: |
| getImport().clear(); |
| return; |
| case DefinitionsPackage.MODULE__NAMESPACE: |
| setNamespace((NamespaceDefinition)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case DefinitionsPackage.MODULE__FILE_NAME: |
| return FILE_NAME_EDEFAULT == null ? fileName != null : !FILE_NAME_EDEFAULT.equals(fileName); |
| case DefinitionsPackage.MODULE__MACHINE: |
| return machine != null && !machine.isEmpty(); |
| case DefinitionsPackage.MODULE__IMPORT: |
| return import_ != null && !import_.isEmpty(); |
| case DefinitionsPackage.MODULE__NAMESPACE: |
| return namespace != null; |
| } |
| 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(" (fileName: "); |
| result.append(fileName); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ModuleImpl |