/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*/
/**
* generated by Xtext 2.10.0
*/
package org.thingml.xtext.thingML.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.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.thingml.xtext.thingML.ConfigPropertyAssign;
import org.thingml.xtext.thingML.Expression;
import org.thingml.xtext.thingML.InstanceRef;
import org.thingml.xtext.thingML.PlatformAnnotation;
import org.thingml.xtext.thingML.Property;
import org.thingml.xtext.thingML.ThingMLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Config Property Assign</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.thingml.xtext.thingML.impl.ConfigPropertyAssignImpl#getInstance <em>Instance</em>}</li>
* <li>{@link org.thingml.xtext.thingML.impl.ConfigPropertyAssignImpl#getProperty <em>Property</em>}</li>
* <li>{@link org.thingml.xtext.thingML.impl.ConfigPropertyAssignImpl#getIndex <em>Index</em>}</li>
* <li>{@link org.thingml.xtext.thingML.impl.ConfigPropertyAssignImpl#getInit <em>Init</em>}</li>
* <li>{@link org.thingml.xtext.thingML.impl.ConfigPropertyAssignImpl#getAnnotations <em>Annotations</em>}</li>
* </ul>
*
* @generated
*/
public class ConfigPropertyAssignImpl extends MinimalEObjectImpl.Container implements ConfigPropertyAssign
{
/**
* The cached value of the '{@link #getInstance() <em>Instance</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInstance()
* @generated
* @ordered
*/
protected InstanceRef instance;
/**
* The cached value of the '{@link #getProperty() <em>Property</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProperty()
* @generated
* @ordered
*/
protected Property property;
/**
* The cached value of the '{@link #getIndex() <em>Index</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIndex()
* @generated
* @ordered
*/
protected EList<Expression> index;
/**
* The cached value of the '{@link #getInit() <em>Init</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInit()
* @generated
* @ordered
*/
protected Expression init;
/**
* The cached value of the '{@link #getAnnotations() <em>Annotations</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotations()
* @generated
* @ordered
*/
protected EList<PlatformAnnotation> annotations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConfigPropertyAssignImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ThingMLPackage.Literals.CONFIG_PROPERTY_ASSIGN;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InstanceRef getInstance()
{
return instance;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInstance(InstanceRef newInstance, NotificationChain msgs)
{
InstanceRef oldInstance = instance;
instance = newInstance;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE, oldInstance, newInstance);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInstance(InstanceRef newInstance)
{
if (newInstance != instance)
{
NotificationChain msgs = null;
if (instance != null)
msgs = ((InternalEObject)instance).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE, null, msgs);
if (newInstance != null)
msgs = ((InternalEObject)newInstance).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE, null, msgs);
msgs = basicSetInstance(newInstance, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE, newInstance, newInstance));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property getProperty()
{
if (property != null && property.eIsProxy())
{
InternalEObject oldProperty = (InternalEObject)property;
property = (Property)eResolveProxy(oldProperty);
if (property != oldProperty)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY, oldProperty, property));
}
}
return property;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property basicGetProperty()
{
return property;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProperty(Property newProperty)
{
Property oldProperty = property;
property = newProperty;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY, oldProperty, property));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Expression> getIndex()
{
if (index == null)
{
index = new EObjectContainmentEList<Expression>(Expression.class, this, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX);
}
return index;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getInit()
{
return init;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInit(Expression newInit, NotificationChain msgs)
{
Expression oldInit = init;
init = newInit;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT, oldInit, newInit);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInit(Expression newInit)
{
if (newInit != init)
{
NotificationChain msgs = null;
if (init != null)
msgs = ((InternalEObject)init).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT, null, msgs);
if (newInit != null)
msgs = ((InternalEObject)newInit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT, null, msgs);
msgs = basicSetInit(newInit, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT, newInit, newInit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<PlatformAnnotation> getAnnotations()
{
if (annotations == null)
{
annotations = new EObjectContainmentEList<PlatformAnnotation>(PlatformAnnotation.class, this, ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS);
}
return annotations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE:
return basicSetInstance(null, msgs);
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX:
return ((InternalEList<?>)getIndex()).basicRemove(otherEnd, msgs);
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT:
return basicSetInit(null, msgs);
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS:
return ((InternalEList<?>)getAnnotations()).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 ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE:
return getInstance();
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY:
if (resolve) return getProperty();
return basicGetProperty();
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX:
return getIndex();
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT:
return getInit();
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS:
return getAnnotations();
}
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 ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE:
setInstance((InstanceRef)newValue);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY:
setProperty((Property)newValue);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX:
getIndex().clear();
getIndex().addAll((Collection<? extends Expression>)newValue);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT:
setInit((Expression)newValue);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS:
getAnnotations().clear();
getAnnotations().addAll((Collection<? extends PlatformAnnotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE:
setInstance((InstanceRef)null);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY:
setProperty((Property)null);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX:
getIndex().clear();
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT:
setInit((Expression)null);
return;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS:
getAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INSTANCE:
return instance != null;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__PROPERTY:
return property != null;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INDEX:
return index != null && !index.isEmpty();
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__INIT:
return init != null;
case ThingMLPackage.CONFIG_PROPERTY_ASSIGN__ANNOTATIONS:
return annotations != null && !annotations.isEmpty();
}
return super.eIsSet(featureID);
}
} //ConfigPropertyAssignImpl