org.eclipse.ocl.expressions.impl.OCLExpressionImpl Maven / Gradle / Ivy
/**
*
*
* Copyright (c) 2006, 2009 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, 207365
*
*
*
* $Id: OCLExpressionImpl.java,v 1.10 2009/01/23 17:16:04 cdamus Exp $
*/
package org.eclipse.ocl.expressions.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.OCLExpression;
//import org.eclipse.ocl.expressions.operations.OCLExpressionOperations;
import org.eclipse.ocl.util.ToStringVisitor;
import org.eclipse.ocl.utilities.ASTNode;
import org.eclipse.ocl.utilities.UtilitiesPackage;
import org.eclipse.ocl.utilities.Visitable;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'OCL Expression'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.OCLExpressionImpl#getStartPosition Start Position}
* - {@link org.eclipse.ocl.expressions.impl.OCLExpressionImpl#getEndPosition End Position}
*
*
*
* @generated
*/
public abstract class OCLExpressionImpl
extends EObjectImpl
implements OCLExpression {
/**
* The default value of the '{@link #getStartPosition() Start Position}' attribute.
*
*
* @see #getStartPosition()
* @generated
* @ordered
*/
protected static final int START_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getStartPosition() Start Position}' attribute.
*
*
* @see #getStartPosition()
* @generated
* @ordered
*/
protected int startPosition = START_POSITION_EDEFAULT;
/**
* The default value of the '{@link #getEndPosition() End Position}' attribute.
*
*
* @see #getEndPosition()
* @generated
* @ordered
*/
protected static final int END_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getEndPosition() End Position}' attribute.
*
*
* @see #getEndPosition()
* @generated
* @ordered
*/
protected int endPosition = END_POSITION_EDEFAULT;
private String name;
private C type;
/**
*
*
* @generated
*/
protected OCLExpressionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.OCL_EXPRESSION;
}
/**
*
*
* @generated NOT
*/
public String getName() {
return name;
}
/**
*
*
* @generated NOT
*/
public C getType() {
return type;
}
/**
*
*
* @generated NOT
*/
public void setName(String name) {
this.name = name;
}
/**
*
*
* @generated NOT
*/
public void setType(C type) {
this.type = type;
}
/**
*
*
* @generated
*/
public int getStartPosition() {
return startPosition;
}
/**
*
*
* @generated
*/
public void setStartPosition(int newStartPosition) {
int oldStartPosition = startPosition;
startPosition = newStartPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.OCL_EXPRESSION__START_POSITION,
oldStartPosition, startPosition));
}
/**
*
*
* @generated
*/
public int getEndPosition() {
return endPosition;
}
/**
*
*
* @generated
*/
public void setEndPosition(int newEndPosition) {
int oldEndPosition = endPosition;
endPosition = newEndPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.OCL_EXPRESSION__END_POSITION,
oldEndPosition, endPosition));
}
/**
*
*
* @generated NOT
*/
public > T accept(U v) {
throw new UnsupportedOperationException();
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ExpressionsPackage.OCL_EXPRESSION__START_POSITION :
return getStartPosition();
case ExpressionsPackage.OCL_EXPRESSION__END_POSITION :
return getEndPosition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionsPackage.OCL_EXPRESSION__START_POSITION :
setStartPosition((Integer) newValue);
return;
case ExpressionsPackage.OCL_EXPRESSION__END_POSITION :
setEndPosition((Integer) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionsPackage.OCL_EXPRESSION__START_POSITION :
setStartPosition(START_POSITION_EDEFAULT);
return;
case ExpressionsPackage.OCL_EXPRESSION__END_POSITION :
setEndPosition(END_POSITION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionsPackage.OCL_EXPRESSION__START_POSITION :
return startPosition != START_POSITION_EDEFAULT;
case ExpressionsPackage.OCL_EXPRESSION__END_POSITION :
return endPosition != END_POSITION_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class> baseClass) {
if (baseClass == Visitable.class) {
switch (derivedFeatureID) {
default :
return -1;
}
}
if (baseClass == ASTNode.class) {
switch (derivedFeatureID) {
case ExpressionsPackage.OCL_EXPRESSION__START_POSITION :
return UtilitiesPackage.AST_NODE__START_POSITION;
case ExpressionsPackage.OCL_EXPRESSION__END_POSITION :
return UtilitiesPackage.AST_NODE__END_POSITION;
default :
return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
*
*
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class> baseClass) {
if (baseClass == Visitable.class) {
switch (baseFeatureID) {
default :
return -1;
}
}
if (baseClass == ASTNode.class) {
switch (baseFeatureID) {
case UtilitiesPackage.AST_NODE__START_POSITION :
return ExpressionsPackage.OCL_EXPRESSION__START_POSITION;
case UtilitiesPackage.AST_NODE__END_POSITION :
return ExpressionsPackage.OCL_EXPRESSION__END_POSITION;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
*
*
* @generated NOT
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
return this
.> accept(ToStringVisitor
.getInstance(this));
}
} //OCLExpressionImpl