/** * Copyright (c) 2007, 2009 Borland Software Corporation 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: * Borland Software Corporation - initial API and implementation * * $Id: VarParameterValueImpl.java,v 1.3 2009/05/15 12:07:10 radvorak Exp $ */ package org.eclipse.m2m.internal.qvt.oml.trace.impl; 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; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.m2m.internal.qvt.oml.trace.EDirectionKind; import org.eclipse.m2m.internal.qvt.oml.trace.EValue; import org.eclipse.m2m.internal.qvt.oml.trace.TracePackage; import org.eclipse.m2m.internal.qvt.oml.trace.VarParameterValue; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Var Parameter Value</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.m2m.internal.qvt.oml.trace.impl.VarParameterValueImpl#getKind <em>Kind</em>}</li> * <li>{@link org.eclipse.m2m.internal.qvt.oml.trace.impl.VarParameterValueImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.m2m.internal.qvt.oml.trace.impl.VarParameterValueImpl#getType <em>Type</em>}</li> * <li>{@link org.eclipse.m2m.internal.qvt.oml.trace.impl.VarParameterValueImpl#getValue <em>Value</em>}</li> * </ul> * * @generated */ public class VarParameterValueImpl extends EObjectImpl implements VarParameterValue { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2007 Borland Software Corporation\r\n\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n \r\nContributors:\r\n Borland Software Corporation - initial API and implementation"; //$NON-NLS-1$ /** * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected static final EDirectionKind KIND_EDEFAULT = EDirectionKind.IN; /** * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected EDirectionKind kind = KIND_EDEFAULT; /** * 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 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 #getValue() <em>Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected EValue value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VarParameterValueImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return TracePackage.Literals.VAR_PARAMETER_VALUE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDirectionKind getKind() { return kind; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setKind(EDirectionKind newKind) { EDirectionKind oldKind = kind; kind = newKind == null ? KIND_EDEFAULT : newKind; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.VAR_PARAMETER_VALUE__KIND, oldKind, kind)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.VAR_PARAMETER_VALUE__NAME, oldName, name)); } /** * <!-- 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, TracePackage.VAR_PARAMETER_VALUE__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EValue getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetValue(EValue newValue, NotificationChain msgs) { EValue oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TracePackage.VAR_PARAMETER_VALUE__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(EValue newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TracePackage.VAR_PARAMETER_VALUE__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TracePackage.VAR_PARAMETER_VALUE__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.VAR_PARAMETER_VALUE__VALUE, newValue, newValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TracePackage.VAR_PARAMETER_VALUE__VALUE: return basicSetValue(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 TracePackage.VAR_PARAMETER_VALUE__KIND: return getKind(); case TracePackage.VAR_PARAMETER_VALUE__NAME: return getName(); case TracePackage.VAR_PARAMETER_VALUE__TYPE: return getType(); case TracePackage.VAR_PARAMETER_VALUE__VALUE: return getValue(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TracePackage.VAR_PARAMETER_VALUE__KIND: setKind((EDirectionKind)newValue); return; case TracePackage.VAR_PARAMETER_VALUE__NAME: setName((String)newValue); return; case TracePackage.VAR_PARAMETER_VALUE__TYPE: setType((String)newValue); return; case TracePackage.VAR_PARAMETER_VALUE__VALUE: setValue((EValue)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TracePackage.VAR_PARAMETER_VALUE__KIND: setKind(KIND_EDEFAULT); return; case TracePackage.VAR_PARAMETER_VALUE__NAME: setName(NAME_EDEFAULT); return; case TracePackage.VAR_PARAMETER_VALUE__TYPE: setType(TYPE_EDEFAULT); return; case TracePackage.VAR_PARAMETER_VALUE__VALUE: setValue((EValue)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TracePackage.VAR_PARAMETER_VALUE__KIND: return kind != KIND_EDEFAULT; case TracePackage.VAR_PARAMETER_VALUE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case TracePackage.VAR_PARAMETER_VALUE__TYPE: return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); case TracePackage.VAR_PARAMETER_VALUE__VALUE: return value != 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(" (kind: "); //$NON-NLS-1$ result.append(kind); result.append(", name: "); //$NON-NLS-1$ result.append(name); result.append(", type: "); //$NON-NLS-1$ result.append(type); result.append(')'); return result.toString(); } } //VarParameterValueImpl