/******************************************************************************* * Copyright (c) 2005, 2008 IBM Corporation, Zeligsoft Inc., 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: * IBM - Initial API and implementation * Zeligsoft - Bug 243976 *******************************************************************************/ package org.eclipse.ocl.cst.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.ocl.cst.CSTPackage; import org.eclipse.ocl.cst.SimpleNameCS; import org.eclipse.ocl.cst.SimpleTypeEnum; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Simple Name CS</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.ocl.cst.impl.SimpleNameCSImpl#getValue <em>Value</em>}</li> * <li>{@link org.eclipse.ocl.cst.impl.SimpleNameCSImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class SimpleNameCSImpl extends OCLExpressionCSImpl implements SimpleNameCS { /** * The default value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected static final String VALUE_EDEFAULT = null; /** * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected String value = VALUE_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 SimpleTypeEnum TYPE_EDEFAULT = SimpleTypeEnum.IDENTIFIER_LITERAL; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected SimpleTypeEnum type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SimpleNameCSImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return CSTPackage.Literals.SIMPLE_NAME_CS; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(String newValue) { String oldValue = value; value = newValue; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CSTPackage.SIMPLE_NAME_CS__VALUE, oldValue, value)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SimpleTypeEnum getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(SimpleTypeEnum newType) { SimpleTypeEnum oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CSTPackage.SIMPLE_NAME_CS__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CSTPackage.SIMPLE_NAME_CS__VALUE : return getValue(); case CSTPackage.SIMPLE_NAME_CS__TYPE : return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case CSTPackage.SIMPLE_NAME_CS__VALUE : setValue((String) newValue); return; case CSTPackage.SIMPLE_NAME_CS__TYPE : setType((SimpleTypeEnum) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CSTPackage.SIMPLE_NAME_CS__VALUE : setValue(VALUE_EDEFAULT); return; case CSTPackage.SIMPLE_NAME_CS__TYPE : setType(TYPE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CSTPackage.SIMPLE_NAME_CS__VALUE : return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); case CSTPackage.SIMPLE_NAME_CS__TYPE : return type != TYPE_EDEFAULT; } 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(" (value: "); //$NON-NLS-1$ result.append(value); result.append(", type: "); //$NON-NLS-1$ result.append(type); result.append(')'); return result.toString(); } } //SimpleNameCSImpl