| /** |
| * Copyright (c) 2018 CEA |
| * |
| * 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: |
| * Jérémie Tatibouet (CEA) jeremie.tatibouet@cea.fr - Initial API and implementation |
| * Benoit Maggi (CEA) benoit.maggi@cea.fr - Initial API and implementation |
| * Shuai Li (CEA) shuai.li@cea.fr - Integration of sensiNact and Web of Things Thing Description |
| * |
| */ |
| package org.eclipse.papyrus.iotml.sensinact.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.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| |
| import org.eclipse.papyrus.iotml.sensinact.AccessMethod; |
| import org.eclipse.papyrus.iotml.sensinact.AccessMethodType; |
| import org.eclipse.papyrus.iotml.sensinact.Parameter; |
| import org.eclipse.papyrus.iotml.sensinact.SensinactPackage; |
| |
| import org.eclipse.uml2.uml.Operation; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Access Method</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.iotml.sensinact.impl.AccessMethodImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.papyrus.iotml.sensinact.impl.AccessMethodImpl#getParameters <em>Parameters</em>}</li> |
| * <li>{@link org.eclipse.papyrus.iotml.sensinact.impl.AccessMethodImpl#getBase_Operation <em>Base Operation</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class AccessMethodImpl extends MinimalEObjectImpl.Container implements AccessMethod { |
| /** |
| * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected static final AccessMethodType TYPE_EDEFAULT = AccessMethodType.GET; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected AccessMethodType type = TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getParameters() <em>Parameters</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getParameters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Parameter> parameters; |
| |
| /** |
| * The cached value of the '{@link #getBase_Operation() <em>Base Operation</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase_Operation() |
| * @generated |
| * @ordered |
| */ |
| protected Operation base_Operation; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected AccessMethodImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return SensinactPackage.Literals.ACCESS_METHOD; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public AccessMethodType getType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setType(AccessMethodType newType) { |
| AccessMethodType oldType = type; |
| type = newType == null ? TYPE_EDEFAULT : newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SensinactPackage.ACCESS_METHOD__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Parameter> getParameters() { |
| if (parameters == null) { |
| parameters = new EObjectResolvingEList<Parameter>(Parameter.class, this, SensinactPackage.ACCESS_METHOD__PARAMETERS); |
| } |
| return parameters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Operation getBase_Operation() { |
| if (base_Operation != null && base_Operation.eIsProxy()) { |
| InternalEObject oldBase_Operation = (InternalEObject)base_Operation; |
| base_Operation = (Operation)eResolveProxy(oldBase_Operation); |
| if (base_Operation != oldBase_Operation) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SensinactPackage.ACCESS_METHOD__BASE_OPERATION, oldBase_Operation, base_Operation)); |
| } |
| } |
| return base_Operation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Operation basicGetBase_Operation() { |
| return base_Operation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBase_Operation(Operation newBase_Operation) { |
| Operation oldBase_Operation = base_Operation; |
| base_Operation = newBase_Operation; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SensinactPackage.ACCESS_METHOD__BASE_OPERATION, oldBase_Operation, base_Operation)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case SensinactPackage.ACCESS_METHOD__TYPE: |
| return getType(); |
| case SensinactPackage.ACCESS_METHOD__PARAMETERS: |
| return getParameters(); |
| case SensinactPackage.ACCESS_METHOD__BASE_OPERATION: |
| if (resolve) return getBase_Operation(); |
| return basicGetBase_Operation(); |
| } |
| 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 SensinactPackage.ACCESS_METHOD__TYPE: |
| setType((AccessMethodType)newValue); |
| return; |
| case SensinactPackage.ACCESS_METHOD__PARAMETERS: |
| getParameters().clear(); |
| getParameters().addAll((Collection<? extends Parameter>)newValue); |
| return; |
| case SensinactPackage.ACCESS_METHOD__BASE_OPERATION: |
| setBase_Operation((Operation)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case SensinactPackage.ACCESS_METHOD__TYPE: |
| setType(TYPE_EDEFAULT); |
| return; |
| case SensinactPackage.ACCESS_METHOD__PARAMETERS: |
| getParameters().clear(); |
| return; |
| case SensinactPackage.ACCESS_METHOD__BASE_OPERATION: |
| setBase_Operation((Operation)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case SensinactPackage.ACCESS_METHOD__TYPE: |
| return type != TYPE_EDEFAULT; |
| case SensinactPackage.ACCESS_METHOD__PARAMETERS: |
| return parameters != null && !parameters.isEmpty(); |
| case SensinactPackage.ACCESS_METHOD__BASE_OPERATION: |
| return base_Operation != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (type: "); |
| result.append(type); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //AccessMethodImpl |