blob: 5844cb0db9d2b705dee838f7b2d7c8682074ef52 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014, 2019 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.xtext.essentialoclcs.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.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectEList;
import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl;
import org.eclipse.ocl.xtext.essentialoclcs.EssentialOCLCSPackage;
import org.eclipse.ocl.xtext.essentialoclcs.ShadowExpCS;
import org.eclipse.ocl.xtext.essentialoclcs.ShadowPartCS;
import org.eclipse.ocl.xtext.essentialoclcs.TypeNameExpCS;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Constructor Exp CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.xtext.essentialoclcs.impl.ShadowExpCSImpl#getParts <em>Parts</em>}</li>
* <li>{@link org.eclipse.ocl.xtext.essentialoclcs.impl.ShadowExpCSImpl#getTypeName <em>Type Name</em>}</li>
* <li>{@link org.eclipse.ocl.xtext.essentialoclcs.impl.ShadowExpCSImpl#getValue <em>Value</em>}</li>
* </ul>
*
* @generated
*/
public abstract class ShadowExpCSImpl extends AbstractNameExpCSImpl implements ShadowExpCS
{
/**
* The number of structural features of the '<em>Shadow Exp CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int SHADOW_EXP_CS_FEATURE_COUNT = AbstractNameExpCSImpl.ABSTRACT_NAME_EXP_CS_FEATURE_COUNT + 3;
/**
* The cached value of the '{@link #getParts() <em>Parts</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParts()
* @generated
* @ordered
*/
protected EList<ShadowPartCS> parts;
/**
* The cached value of the '{@link #getTypeName() <em>Type Name</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeName()
* @generated
* @ordered
*/
protected TypeNameExpCS typeName;
/**
* 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ShadowExpCSImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EssentialOCLCSPackage.Literals.SHADOW_EXP_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public TypeNameExpCS getTypeName()
{
return typeName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTypeName(TypeNameExpCS newTypeName)
{
TypeNameExpCS oldTypeName = typeName;
typeName = newTypeName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 16, oldTypeName, typeName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<ShadowPartCS> getParts()
{
if (parts == null)
{
parts = new EObjectEList<ShadowPartCS>(ShadowPartCS.class, this, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 15);
}
return parts;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getValue()
{
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setValue(String newValue)
{
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 17, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 15:
return getParts();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 16:
return getTypeName();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 17:
return getValue();
}
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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 15:
getParts().clear();
getParts().addAll((Collection<? extends ShadowPartCS>)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 16:
setTypeName((TypeNameExpCS)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 17:
setValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 15:
getParts().clear();
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 16:
setTypeName((TypeNameExpCS)null);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 17:
setValue(VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 15:
return parts != null && !parts.isEmpty();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 16:
return typeName != null;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 17:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
}
} //ShadowExpCSImpl