org.eclipse.ocl.cst.impl.SimpleNameCSImpl Maven / Gradle / Ivy
/**
*
*
* 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
*
*
*
* $Id: SimpleNameCSImpl.java,v 1.3 2008/11/30 22:11:37 cdamus Exp $
*/
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;
/**
*
* An implementation of the model object 'Simple Name CS'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.cst.impl.SimpleNameCSImpl#getValue Value}
* - {@link org.eclipse.ocl.cst.impl.SimpleNameCSImpl#getType Type}
*
*
*
* @generated
*/
public class SimpleNameCSImpl
extends OCLExpressionCSImpl
implements SimpleNameCS {
/**
* The default value of the '{@link #getValue() Value}' attribute.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() Value}' attribute.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final SimpleTypeEnum TYPE_EDEFAULT = SimpleTypeEnum.IDENTIFIER_LITERAL;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected SimpleTypeEnum type = TYPE_EDEFAULT;
/**
*
*
* @generated
*/
protected SimpleNameCSImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CSTPackage.Literals.SIMPLE_NAME_CS;
}
/**
*
*
* @generated
*/
public String getValue() {
return value;
}
/**
*
*
* @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));
}
/**
*
*
* @generated
*/
public SimpleTypeEnum getType() {
return type;
}
/**
*
*
* @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));
}
/**
*
*
* @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);
}
/**
*
*
* @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);
}
/**
*
*
* @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);
}
/**
*
*
* @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);
}
/**
*
*
* @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