blob: 6cf2c3868af6cae98617e8cc25429987bbd20d64 [file] [log] [blame]
/**
* Copyright (c) 2011, 2017 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.statemachine.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryOperation;
import org.eclipse.osbp.xtext.statemachine.StatemachineDSLPackage;
import org.eclipse.osbp.xtext.statemachine.StatemachineOperation;
import org.eclipse.osbp.xtext.statemachine.StatemachineOperationParameter;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Statemachine Operation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.StatemachineOperationImpl#getOperation <em>Operation</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.StatemachineOperationImpl#getFirst <em>First</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.StatemachineOperationImpl#getMore <em>More</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class StatemachineOperationImpl extends StatemachineLazyResolverImpl implements StatemachineOperation {
/**
* The cached value of the '{@link #getOperation() <em>Operation</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperation()
* @generated
* @ordered
*/
protected FunctionLibraryOperation operation;
/**
* The cached value of the '{@link #getFirst() <em>First</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFirst()
* @generated
* @ordered
*/
protected StatemachineOperationParameter first;
/**
* The cached value of the '{@link #getMore() <em>More</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMore()
* @generated
* @ordered
*/
protected EList<StatemachineOperationParameter> more;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StatemachineOperationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatemachineDSLPackage.Literals.STATEMACHINE_OPERATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FunctionLibraryOperation getOperation() {
if (operation != null && operation.eIsProxy()) {
InternalEObject oldOperation = (InternalEObject)operation;
operation = (FunctionLibraryOperation)eResolveProxy(oldOperation);
if (operation != oldOperation) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION, oldOperation, operation));
}
}
return operation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FunctionLibraryOperation basicGetOperation() {
return operation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperation(FunctionLibraryOperation newOperation) {
FunctionLibraryOperation oldOperation = operation;
operation = newOperation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION, oldOperation, operation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StatemachineOperationParameter getFirst() {
return first;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFirst(StatemachineOperationParameter newFirst, NotificationChain msgs) {
StatemachineOperationParameter oldFirst = first;
first = newFirst;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST, oldFirst, newFirst);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFirst(StatemachineOperationParameter newFirst) {
if (newFirst != first) {
NotificationChain msgs = null;
if (first != null)
msgs = ((InternalEObject)first).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST, null, msgs);
if (newFirst != null)
msgs = ((InternalEObject)newFirst).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST, null, msgs);
msgs = basicSetFirst(newFirst, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST, newFirst, newFirst));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<StatemachineOperationParameter> getMore() {
if (more == null) {
more = new EObjectContainmentEList<StatemachineOperationParameter>(StatemachineOperationParameter.class, this, StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE);
}
return more;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST:
return basicSetFirst(null, msgs);
case StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE:
return ((InternalEList<?>)getMore()).basicRemove(otherEnd, 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 StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION:
if (resolve) return getOperation();
return basicGetOperation();
case StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST:
return getFirst();
case StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE:
return getMore();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION:
setOperation((FunctionLibraryOperation)newValue);
return;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST:
setFirst((StatemachineOperationParameter)newValue);
return;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE:
getMore().clear();
getMore().addAll((Collection<? extends StatemachineOperationParameter>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION:
setOperation((FunctionLibraryOperation)null);
return;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST:
setFirst((StatemachineOperationParameter)null);
return;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE:
getMore().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.STATEMACHINE_OPERATION__OPERATION:
return operation != null;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__FIRST:
return first != null;
case StatemachineDSLPackage.STATEMACHINE_OPERATION__MORE:
return more != null && !more.isEmpty();
}
return super.eIsSet(featureID);
}
} //StatemachineOperationImpl