blob: d82976c3d3e119e47e4a30ad4fa359e8403c0d27 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2018 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 v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bugs 241426, 207365
*******************************************************************************/
package org.eclipse.ocl.ecore.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.ecore.EcorePackage;
import org.eclipse.ocl.ecore.UnspecifiedValueExp;
import org.eclipse.ocl.utilities.TypedASTNode;
import org.eclipse.ocl.utilities.UtilitiesPackage;
import org.eclipse.ocl.utilities.Visitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Unspecified Value Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.ecore.impl.UnspecifiedValueExpImpl#getTypeStartPosition <em>Type Start Position</em>}</li>
* <li>{@link org.eclipse.ocl.ecore.impl.UnspecifiedValueExpImpl#getTypeEndPosition <em>Type End Position</em>}</li>
* </ul>
*
* @generated
*/
public class UnspecifiedValueExpImpl
extends OCLExpressionImpl
implements UnspecifiedValueExp {
/**
* The default value of the '{@link #getTypeStartPosition() <em>Type Start Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeStartPosition()
* @generated
* @ordered
*/
protected static final int TYPE_START_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getTypeStartPosition() <em>Type Start Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeStartPosition()
* @generated
* @ordered
*/
protected int typeStartPosition = TYPE_START_POSITION_EDEFAULT;
/**
* The default value of the '{@link #getTypeEndPosition() <em>Type End Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeEndPosition()
* @generated
* @ordered
*/
protected static final int TYPE_END_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getTypeEndPosition() <em>Type End Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeEndPosition()
* @generated
* @ordered
*/
protected int typeEndPosition = TYPE_END_POSITION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UnspecifiedValueExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EcorePackage.Literals.UNSPECIFIED_VALUE_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getTypeStartPosition() {
return typeStartPosition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTypeStartPosition(int newTypeStartPosition) {
int oldTypeStartPosition = typeStartPosition;
typeStartPosition = newTypeStartPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION,
oldTypeStartPosition, typeStartPosition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getTypeEndPosition() {
return typeEndPosition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTypeEndPosition(int newTypeEndPosition) {
int oldTypeEndPosition = typeEndPosition;
typeEndPosition = newTypeEndPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION,
oldTypeEndPosition, typeEndPosition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION :
return getTypeStartPosition();
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION :
return getTypeEndPosition();
}
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.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION :
setTypeStartPosition((Integer) newValue);
return;
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION :
setTypeEndPosition((Integer) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION :
setTypeStartPosition(TYPE_START_POSITION_EDEFAULT);
return;
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION :
setTypeEndPosition(TYPE_END_POSITION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION :
return typeStartPosition != TYPE_START_POSITION_EDEFAULT;
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION :
return typeEndPosition != TYPE_END_POSITION_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID,
Class<?> baseClass) {
if (baseClass == TypedASTNode.class) {
switch (derivedFeatureID) {
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION :
return UtilitiesPackage.TYPED_AST_NODE__TYPE_START_POSITION;
case EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION :
return UtilitiesPackage.TYPED_AST_NODE__TYPE_END_POSITION;
default :
return -1;
}
}
if (baseClass == org.eclipse.ocl.expressions.UnspecifiedValueExp.class) {
switch (derivedFeatureID) {
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 == TypedASTNode.class) {
switch (baseFeatureID) {
case UtilitiesPackage.TYPED_AST_NODE__TYPE_START_POSITION :
return EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_START_POSITION;
case UtilitiesPackage.TYPED_AST_NODE__TYPE_END_POSITION :
return EcorePackage.UNSPECIFIED_VALUE_EXP__TYPE_END_POSITION;
default :
return -1;
}
}
if (baseClass == org.eclipse.ocl.expressions.UnspecifiedValueExp.class) {
switch (baseFeatureID) {
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* @generated NOT
*/
@Override
@SuppressWarnings("unchecked")
public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(U v) {
return ((Visitor<T, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?>) v)
.visitUnspecifiedValueExp(this);
}
} //UnspecifiedValueExpImpl