blob: 180b0ad67efad7e30870785fe7a6fdccf065044e [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2013, 2019 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
*
* </copyright>
*/
package org.eclipse.qvtd.xtext.qvtimperativecs.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.xtext.basecs.impl.TypedElementCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.BufferStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.QVTimperativeCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Buffer Statement CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.BufferStatementCSImpl#isIsStrict <em>Is Strict</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.BufferStatementCSImpl#getOwnedExpression <em>Owned Expression</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.BufferStatementCSImpl#getFirstPass <em>First Pass</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.BufferStatementCSImpl#getLastPass <em>Last Pass</em>}</li>
* </ul>
*
* @generated
*/
public class BufferStatementCSImpl extends TypedElementCSImpl implements BufferStatementCS {
/**
* The number of structural features of the '<em>Buffer Statement CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int BUFFER_STATEMENT_CS_FEATURE_COUNT = TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 4;
/**
* The default value of the '{@link #isIsStrict() <em>Is Strict</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsStrict()
* @generated
* @ordered
*/
protected static final boolean IS_STRICT_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsStrict() <em>Is Strict</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsStrict()
* @generated
* @ordered
*/
protected boolean isStrict = IS_STRICT_EDEFAULT;
/**
* The cached value of the '{@link #getOwnedExpression() <em>Owned Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedExpression()
* @generated
* @ordered
*/
protected ExpCS ownedExpression;
/**
* The default value of the '{@link #getFirstPass() <em>First Pass</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFirstPass()
* @generated
* @ordered
*/
protected static final Integer FIRST_PASS_EDEFAULT = null;
/**
* The cached value of the '{@link #getFirstPass() <em>First Pass</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFirstPass()
* @generated
* @ordered
*/
protected Integer firstPass = FIRST_PASS_EDEFAULT;
/**
* The default value of the '{@link #getLastPass() <em>Last Pass</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastPass()
* @generated
* @ordered
*/
protected static final Integer LAST_PASS_EDEFAULT = null;
/**
* The cached value of the '{@link #getLastPass() <em>Last Pass</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastPass()
* @generated
* @ordered
*/
protected Integer lastPass = LAST_PASS_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BufferStatementCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTimperativeCSPackage.Literals.BUFFER_STATEMENT_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsStrict() {
return isStrict;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsStrict(boolean newIsStrict) {
boolean oldIsStrict = isStrict;
isStrict = newIsStrict;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0, oldIsStrict, isStrict));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ExpCS getOwnedExpression() {
return ownedExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedExpression(ExpCS newOwnedExpression, NotificationChain msgs) {
ExpCS oldOwnedExpression = ownedExpression;
ownedExpression = newOwnedExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1, oldOwnedExpression, newOwnedExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedExpression(ExpCS newOwnedExpression) {
if (newOwnedExpression != ownedExpression) {
NotificationChain msgs = null;
if (ownedExpression != null)
msgs = ((InternalEObject)ownedExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1), null, msgs);
if (newOwnedExpression != null)
msgs = ((InternalEObject)newOwnedExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1), null, msgs);
msgs = basicSetOwnedExpression(newOwnedExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1, newOwnedExpression, newOwnedExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Integer getFirstPass() {
return firstPass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setFirstPass(Integer newFirstPass) {
Integer oldFirstPass = firstPass;
firstPass = newFirstPass;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 2, oldFirstPass, firstPass));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Integer getLastPass() {
return lastPass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setLastPass(Integer newLastPass) {
Integer oldLastPass = lastPass;
lastPass = newLastPass;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 3, oldLastPass, lastPass));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1:
return basicSetOwnedExpression(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
return isIsStrict();
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1:
return getOwnedExpression();
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 2:
return getFirstPass();
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 3:
return getLastPass();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
setIsStrict((Boolean)newValue);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1:
setOwnedExpression((ExpCS)newValue);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 2:
setFirstPass((Integer)newValue);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 3:
setLastPass((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
setIsStrict(IS_STRICT_EDEFAULT);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1:
setOwnedExpression((ExpCS)null);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 2:
setFirstPass(FIRST_PASS_EDEFAULT);
return;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 3:
setLastPass(LAST_PASS_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
return isStrict != IS_STRICT_EDEFAULT;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 1:
return ownedExpression != null;
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 2:
return FIRST_PASS_EDEFAULT == null ? firstPass != null : !FIRST_PASS_EDEFAULT.equals(firstPass);
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 3:
return LAST_PASS_EDEFAULT == null ? lastPass != null : !LAST_PASS_EDEFAULT.equals(lastPass);
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
if (visitor instanceof QVTimperativeCSVisitor) {
return (R) ((QVTimperativeCSVisitor<?>)visitor).visitBufferStatementCS(this);
}
else {
return super.accept(visitor);
}
}
} //BufferStatementCSImpl