| /** |
| * Copyright (c) 2016 Willink Transformations, Univesity of York 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: |
| * Adolfo Sanchez-Barbudo Herrera - initial API and implementation |
| */ |
| package astm.impl; |
| |
| import astm.AstmPackage; |
| import astm.EntryDefinition; |
| import astm.FormalParameterDefinition; |
| import astm.Statement; |
| |
| import astm.util.Visitor; |
| |
| import java.util.Collection; |
| |
| 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.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Entry Definition</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link astm.impl.EntryDefinitionImpl#getFormalParameters <em>Formal Parameters</em>}</li> |
| * <li>{@link astm.impl.EntryDefinitionImpl#getBody <em>Body</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EntryDefinitionImpl extends DefinitionImpl implements EntryDefinition { |
| /** |
| * The cached value of the '{@link #getFormalParameters() <em>Formal Parameters</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFormalParameters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<FormalParameterDefinition> formalParameters; |
| |
| /** |
| * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBody() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Statement> body; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EntryDefinitionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AstmPackage.Literals.ENTRY_DEFINITION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<FormalParameterDefinition> getFormalParameters() { |
| if (formalParameters == null) { |
| formalParameters = new EObjectContainmentEList<FormalParameterDefinition>(FormalParameterDefinition.class, this, AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS); |
| } |
| return formalParameters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Statement> getBody() { |
| if (body == null) { |
| body = new EObjectContainmentEList<Statement>(Statement.class, this, AstmPackage.ENTRY_DEFINITION__BODY); |
| } |
| return body; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS: |
| return ((InternalEList<?>)getFormalParameters()).basicRemove(otherEnd, msgs); |
| case AstmPackage.ENTRY_DEFINITION__BODY: |
| return ((InternalEList<?>)getBody()).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 AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS: |
| return getFormalParameters(); |
| case AstmPackage.ENTRY_DEFINITION__BODY: |
| return getBody(); |
| } |
| 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 AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS: |
| getFormalParameters().clear(); |
| getFormalParameters().addAll((Collection<? extends FormalParameterDefinition>)newValue); |
| return; |
| case AstmPackage.ENTRY_DEFINITION__BODY: |
| getBody().clear(); |
| getBody().addAll((Collection<? extends Statement>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS: |
| getFormalParameters().clear(); |
| return; |
| case AstmPackage.ENTRY_DEFINITION__BODY: |
| getBody().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AstmPackage.ENTRY_DEFINITION__FORMAL_PARAMETERS: |
| return formalParameters != null && !formalParameters.isEmpty(); |
| case AstmPackage.ENTRY_DEFINITION__BODY: |
| return body != null && !body.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitEntryDefinition(this); |
| } |
| |
| } //EntryDefinitionImpl |