/******************************************************************************* * Copyright (c) 2007, 2010 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 207365 - Maintain currency with JDT compiler *******************************************************************************/ 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.emf.ecore.impl.ETypedElementImpl; import org.eclipse.ocl.ecore.EcorePackage; import org.eclipse.ocl.ecore.OCLExpression; import org.eclipse.ocl.ecore.utilities.ToStringVisitor; import org.eclipse.ocl.utilities.ASTNode; import org.eclipse.ocl.utilities.TypedElement; import org.eclipse.ocl.utilities.UtilitiesPackage; import org.eclipse.ocl.utilities.Visitable; import org.eclipse.ocl.utilities.Visitor; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>OCL Expression</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.ocl.ecore.impl.OCLExpressionImpl#getStartPosition <em>Start Position</em>}</li> * <li>{@link org.eclipse.ocl.ecore.impl.OCLExpressionImpl#getEndPosition <em>End Position</em>}</li> * </ul> * * @generated */ public abstract class OCLExpressionImpl extends ETypedElementImpl implements OCLExpression { /** * The default value of the '{@link #getStartPosition() <em>Start Position</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStartPosition() * @generated * @ordered */ protected static final int START_POSITION_EDEFAULT = -1; /** * The cached value of the '{@link #getStartPosition() <em>Start Position</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStartPosition() * @generated * @ordered */ protected int startPosition = START_POSITION_EDEFAULT; /** * The default value of the '{@link #getEndPosition() <em>End Position</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEndPosition() * @generated * @ordered */ protected static final int END_POSITION_EDEFAULT = -1; /** * The cached value of the '{@link #getEndPosition() <em>End Position</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEndPosition() * @generated * @ordered */ protected int endPosition = END_POSITION_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OCLExpressionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EcorePackage.Literals.OCL_EXPRESSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getStartPosition() { return startPosition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStartPosition(int newStartPosition) { int oldStartPosition = startPosition; startPosition = newStartPosition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.OCL_EXPRESSION__START_POSITION, oldStartPosition, startPosition)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getEndPosition() { return endPosition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEndPosition(int newEndPosition) { int oldEndPosition = endPosition; endPosition = newEndPosition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.OCL_EXPRESSION__END_POSITION, oldEndPosition, endPosition)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(U v) { // Subclasses must implement this method throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public EClassifier getType() { return getEType(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public void setType(EClassifier type) { setEType(type); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case EcorePackage.OCL_EXPRESSION__START_POSITION : return getStartPosition(); case EcorePackage.OCL_EXPRESSION__END_POSITION : return getEndPosition(); } 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.OCL_EXPRESSION__START_POSITION : setStartPosition((Integer) newValue); return; case EcorePackage.OCL_EXPRESSION__END_POSITION : setEndPosition((Integer) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EcorePackage.OCL_EXPRESSION__START_POSITION : setStartPosition(START_POSITION_EDEFAULT); return; case EcorePackage.OCL_EXPRESSION__END_POSITION : setEndPosition(END_POSITION_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EcorePackage.OCL_EXPRESSION__START_POSITION : return startPosition != START_POSITION_EDEFAULT; case EcorePackage.OCL_EXPRESSION__END_POSITION : return endPosition != END_POSITION_EDEFAULT; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == TypedElement.class) { switch (derivedFeatureID) { default : return -1; } } if (baseClass == Visitable.class) { switch (derivedFeatureID) { default : return -1; } } if (baseClass == ASTNode.class) { switch (derivedFeatureID) { case EcorePackage.OCL_EXPRESSION__START_POSITION : return UtilitiesPackage.AST_NODE__START_POSITION; case EcorePackage.OCL_EXPRESSION__END_POSITION : return UtilitiesPackage.AST_NODE__END_POSITION; default : return -1; } } if (baseClass == org.eclipse.ocl.expressions.OCLExpression.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 == TypedElement.class) { switch (baseFeatureID) { default : return -1; } } if (baseClass == Visitable.class) { switch (baseFeatureID) { default : return -1; } } if (baseClass == ASTNode.class) { switch (baseFeatureID) { case UtilitiesPackage.AST_NODE__START_POSITION : return EcorePackage.OCL_EXPRESSION__START_POSITION; case UtilitiesPackage.AST_NODE__END_POSITION : return EcorePackage.OCL_EXPRESSION__END_POSITION; default : return -1; } } if (baseClass == org.eclipse.ocl.expressions.OCLExpression.class) { switch (baseFeatureID) { default : return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ @Override public String toString() { if (eIsProxy()) { return super.toString(); } return accept(ToStringVisitor.getInstance(this)); } } //OCLExpressionImpl