blob: 3e986f5cc8065526c35b66808165ecede05ad862 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2018 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.ecore.impl;
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.EOperation;
import org.eclipse.emf.ecore.impl.EClassifierImpl;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.ecore.EcorePackage;
import org.eclipse.ocl.ecore.TemplateParameterType;
import org.eclipse.ocl.ecore.TypeType;
import org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl;
import org.eclipse.ocl.types.TypesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Template Parameter Type</b></em>'.
* @since 3.0
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.ecore.impl.TemplateParameterTypeImpl#getSpecification <em>Specification</em>}</li>
* </ul>
*
* @generated
*/
public class TemplateParameterTypeImpl
extends EClassifierImpl
implements TemplateParameterType {
private EList<EOperation> operations;
/**
* The default value of the '{@link #getSpecification() <em>Specification</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSpecification()
* @generated
* @ordered
*/
protected static final String SPECIFICATION_EDEFAULT = null;
/**
* The cached value of the '{@link #getSpecification() <em>Specification</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSpecification()
* @generated
* @ordered
*/
protected String specification = SPECIFICATION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TemplateParameterTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EcorePackage.Literals.TEMPLATE_PARAMETER_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSpecification() {
return specification;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSpecification(String newSpecification) {
String oldSpecification = specification;
specification = newSpecification;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION,
oldSpecification, specification));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EList<EOperation> oclOperations() {
if (operations == null) {
TypeType prototype = (TypeType) OCLStandardLibraryImpl.INSTANCE
.getOclType();
if (prototype == this) {
// I *am* the standard library type!
operations = OCLStandardLibraryImpl.getExistingOperations(this);
} else {
// the prototype defines my operations for me
operations = prototype.oclOperations();
}
}
return operations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
return getSpecification();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
setSpecification((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
setSpecification(SPECIFICATION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
return SPECIFICATION_EDEFAULT == null
? specification != null
: !SPECIFICATION_EDEFAULT.equals(specification);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID,
Class<?> baseClass) {
if (baseClass == org.eclipse.ocl.types.TemplateParameterType.class) {
switch (derivedFeatureID) {
case EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
return TypesPackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION;
default :
return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID,
Class<?> baseClass) {
if (baseClass == org.eclipse.ocl.types.TemplateParameterType.class) {
switch (baseFeatureID) {
case TypesPackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION :
return EcorePackage.TEMPLATE_PARAMETER_TYPE__SPECIFICATION;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (specification: "); //$NON-NLS-1$
result.append(specification);
result.append(')');
return result.toString();
}
} //TemplateParameterTypeImpl