org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl 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
*
*
*
* $Id: TupleLiteralPartImpl.java,v 1.10 2009/01/23 17:16:03 cdamus Exp $
*/
package org.eclipse.ocl.expressions.impl;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
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.TupleLiteralPart;
import org.eclipse.ocl.expressions.operations.TupleLiteralPartOperations;
import org.eclipse.ocl.util.ToStringVisitor;
import org.eclipse.ocl.utilities.ASTNode;
import org.eclipse.ocl.utilities.TypedASTNode;
import org.eclipse.ocl.utilities.UtilitiesPackage;
import org.eclipse.ocl.utilities.Visitable;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'Tuple Literal Part'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getStartPosition Start Position}
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getEndPosition End Position}
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getTypeStartPosition Type Start Position}
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getTypeEndPosition Type End Position}
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getValue Value}
* - {@link org.eclipse.ocl.expressions.impl.TupleLiteralPartImpl#getAttribute Attribute}
*
*
*
* @generated
*/
public class TupleLiteralPartImpl
extends EObjectImpl
implements TupleLiteralPart {
/**
* 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;
/**
* The default value of the '{@link #getTypeStartPosition() Type Start Position}' attribute.
*
*
* @see #getTypeStartPosition()
* @generated
* @ordered
*/
protected static final int TYPE_START_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getTypeStartPosition() Type Start Position}' attribute.
*
*
* @see #getTypeStartPosition()
* @generated
* @ordered
*/
protected int typeStartPosition = TYPE_START_POSITION_EDEFAULT;
/**
* The default value of the '{@link #getTypeEndPosition() Type End Position}' attribute.
*
*
* @see #getTypeEndPosition()
* @generated
* @ordered
*/
protected static final int TYPE_END_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getTypeEndPosition() Type End Position}' attribute.
*
*
* @see #getTypeEndPosition()
* @generated
* @ordered
*/
protected int typeEndPosition = TYPE_END_POSITION_EDEFAULT;
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected OCLExpression value;
/**
* The cached value of the '{@link #getAttribute() Attribute}' reference.
*
*
* @see #getAttribute()
* @generated
* @ordered
*/
protected P attribute;
private String name;
private C type;
/**
*
*
* @generated
*/
protected TupleLiteralPartImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.TUPLE_LITERAL_PART;
}
/**
*
*
* @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.TUPLE_LITERAL_PART__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.TUPLE_LITERAL_PART__END_POSITION,
oldEndPosition, endPosition));
}
/**
*
*
* @generated
*/
public int getTypeStartPosition() {
return typeStartPosition;
}
/**
*
*
* @generated
*/
public void setTypeStartPosition(int newTypeStartPosition) {
int oldTypeStartPosition = typeStartPosition;
typeStartPosition = newTypeStartPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.TUPLE_LITERAL_PART__TYPE_START_POSITION,
oldTypeStartPosition, typeStartPosition));
}
/**
*
*
* @generated
*/
public int getTypeEndPosition() {
return typeEndPosition;
}
/**
*
*
* @generated
*/
public void setTypeEndPosition(int newTypeEndPosition) {
int oldTypeEndPosition = typeEndPosition;
typeEndPosition = newTypeEndPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.TUPLE_LITERAL_PART__TYPE_END_POSITION,
oldTypeEndPosition, typeEndPosition));
}
/**
*
*
* @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 OCLExpression getValue() {
return value;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetValue(OCLExpression newValue,
NotificationChain msgs) {
OCLExpression oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.TUPLE_LITERAL_PART__VALUE,
oldValue, newValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setValue(OCLExpression newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject) value).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.TUPLE_LITERAL_PART__VALUE, null,
msgs);
if (newValue != null)
msgs = ((InternalEObject) newValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.TUPLE_LITERAL_PART__VALUE, null,
msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.TUPLE_LITERAL_PART__VALUE, newValue,
newValue));
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
public P getAttribute() {
if (attribute != null && ((EObject) attribute).eIsProxy()) {
InternalEObject oldAttribute = (InternalEObject) attribute;
attribute = (P) eResolveProxy(oldAttribute);
if (attribute != oldAttribute) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
ExpressionsPackage.TUPLE_LITERAL_PART__ATTRIBUTE,
oldAttribute, attribute));
}
}
return attribute;
}
/**
*
*
* @generated
*/
public P basicGetAttribute() {
return attribute;
}
/**
*
*
* @generated
*/
public void setAttribute(P newAttribute) {
P oldAttribute = attribute;
attribute = newAttribute;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.TUPLE_LITERAL_PART__ATTRIBUTE, oldAttribute,
attribute));
}
/**
*
*
* @generated NOT
*/
@SuppressWarnings("unchecked")
public > T accept(U v) {
return ((Visitor) v)
.visitTupleLiteralPart(this);
}
/**
*
*
* @generated
*/
public boolean checkValueType(DiagnosticChain diagnostics,
Map