org.eclipse.ocl.expressions.impl.StateExpImpl 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
*
* Contributors:
* IBM - Initial API and implementation
*
*
*
* $Id: StateExpImpl.java,v 1.7 2009/01/23 17:16:03 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.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.StateExp;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'State Exp'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.StateExpImpl#getReferredState Referred State}
*
*
*
* @generated
*/
public class StateExpImpl
extends OCLExpressionImpl
implements StateExp {
/**
* The cached value of the '{@link #getReferredState() Referred State}' reference.
*
*
* @see #getReferredState()
* @generated
* @ordered
*/
protected S referredState;
/**
*
*
* @generated
*/
protected StateExpImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.STATE_EXP;
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
public S getReferredState() {
if (referredState != null && ((EObject) referredState).eIsProxy()) {
InternalEObject oldReferredState = (InternalEObject) referredState;
referredState = (S) eResolveProxy(oldReferredState);
if (referredState != oldReferredState) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
ExpressionsPackage.STATE_EXP__REFERRED_STATE,
oldReferredState, referredState));
}
}
return referredState;
}
/**
*
*
* @generated
*/
public S basicGetReferredState() {
return referredState;
}
/**
*
*
* @generated
*/
public void setReferredState(S newReferredState) {
S oldReferredState = referredState;
referredState = newReferredState;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.STATE_EXP__REFERRED_STATE, oldReferredState,
referredState));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ExpressionsPackage.STATE_EXP__REFERRED_STATE :
if (resolve)
return getReferredState();
return basicGetReferredState();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionsPackage.STATE_EXP__REFERRED_STATE :
setReferredState((S) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionsPackage.STATE_EXP__REFERRED_STATE :
setReferredState((S) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionsPackage.STATE_EXP__REFERRED_STATE :
return referredState != null;
}
return super.eIsSet(featureID);
}
/**
* @generated NOT
*/
@Override
@SuppressWarnings("unchecked")
public > T accept(U v) {
return ((Visitor) v).visitStateExp(this);
}
} //StateExpImpl