| /** |
| * |
| * Copyright (c) 2009-2010 Thales Corporate Services S.A.S. |
| * 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: |
| * Thales Corporate Services S.A.S - initial API and implementation |
| * |
| */ |
| package org.eclipse.egf.model.pattern.impl; |
| |
| import org.eclipse.egf.model.fcore.impl.NamedModelElementImpl; |
| import org.eclipse.egf.model.pattern.PatternPackage; |
| import org.eclipse.egf.model.pattern.PatternParameter; |
| import org.eclipse.egf.model.pattern.Query; |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Parameter</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.egf.model.pattern.impl.PatternParameterImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.egf.model.pattern.impl.PatternParameterImpl#getQuery <em>Query</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class PatternParameterImpl extends NamedModelElementImpl implements PatternParameter { |
| /** |
| * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| protected int eFlags = 0; |
| |
| /** |
| * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TYPE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected String type = TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getQuery() |
| * @generated |
| * @ordered |
| */ |
| protected Query query; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PatternParameterImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return PatternPackage.Literals.PATTERN_PARAMETER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(String newType) { |
| String oldType = type; |
| type = newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, PatternPackage.PATTERN_PARAMETER__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Query getQuery() { |
| return query; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { |
| Query oldQuery = query; |
| query = newQuery; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PatternPackage.PATTERN_PARAMETER__QUERY, oldQuery, newQuery); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setQuery(Query newQuery) { |
| if (newQuery != query) { |
| NotificationChain msgs = null; |
| if (query != null) |
| msgs = ((InternalEObject) query).eInverseRemove(this, PatternPackage.QUERY__PARAMETER, Query.class, msgs); |
| if (newQuery != null) |
| msgs = ((InternalEObject) newQuery).eInverseAdd(this, PatternPackage.QUERY__PARAMETER, Query.class, msgs); |
| msgs = basicSetQuery(newQuery, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, PatternPackage.PATTERN_PARAMETER__QUERY, newQuery, newQuery)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case PatternPackage.PATTERN_PARAMETER__QUERY: |
| if (query != null) |
| msgs = ((InternalEObject) query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PatternPackage.PATTERN_PARAMETER__QUERY, null, msgs); |
| return basicSetQuery((Query) 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 PatternPackage.PATTERN_PARAMETER__QUERY: |
| return basicSetQuery(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 PatternPackage.PATTERN_PARAMETER__TYPE: |
| return getType(); |
| case PatternPackage.PATTERN_PARAMETER__QUERY: |
| return getQuery(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case PatternPackage.PATTERN_PARAMETER__TYPE: |
| setType((String) newValue); |
| return; |
| case PatternPackage.PATTERN_PARAMETER__QUERY: |
| setQuery((Query) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case PatternPackage.PATTERN_PARAMETER__TYPE: |
| setType(TYPE_EDEFAULT); |
| return; |
| case PatternPackage.PATTERN_PARAMETER__QUERY: |
| setQuery((Query) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case PatternPackage.PATTERN_PARAMETER__TYPE: |
| return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); |
| case PatternPackage.PATTERN_PARAMETER__QUERY: |
| return query != 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(" (type: "); //$NON-NLS-1$ |
| result.append(type); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // PatternParameterImpl |