/**
* 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 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.thingml.xtext.thingML.Expression;
import org.thingml.xtext.thingML.OrExpression;
import org.thingml.xtext.thingML.ThingMLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Or Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.thingml.xtext.thingML.impl.OrExpressionImpl#getLhs <em>Lhs</em>}</li>
* <li>{@link org.thingml.xtext.thingML.impl.OrExpressionImpl#getRhs <em>Rhs</em>}</li>
* </ul>
*
* @generated
*/
public class OrExpressionImpl extends ExpressionImpl implements OrExpression
{
/**
* The cached value of the '{@link #getLhs() <em>Lhs</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLhs()
* @generated
* @ordered
*/
protected Expression lhs;
/**
* The cached value of the '{@link #getRhs() <em>Rhs</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRhs()
* @generated
* @ordered
*/
protected Expression rhs;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OrExpressionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ThingMLPackage.Literals.OR_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getLhs()
{
return lhs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLhs(Expression newLhs, NotificationChain msgs)
{
Expression oldLhs = lhs;
lhs = newLhs;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThingMLPackage.OR_EXPRESSION__LHS, oldLhs, newLhs);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLhs(Expression newLhs)
{
if (newLhs != lhs)
{
NotificationChain msgs = null;
if (lhs != null)
msgs = ((InternalEObject)lhs).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.OR_EXPRESSION__LHS, null, msgs);
if (newLhs != null)
msgs = ((InternalEObject)newLhs).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.OR_EXPRESSION__LHS, null, msgs);
msgs = basicSetLhs(newLhs, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThingMLPackage.OR_EXPRESSION__LHS, newLhs, newLhs));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getRhs()
{
return rhs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRhs(Expression newRhs, NotificationChain msgs)
{
Expression oldRhs = rhs;
rhs = newRhs;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ThingMLPackage.OR_EXPRESSION__RHS, oldRhs, newRhs);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRhs(Expression newRhs)
{
if (newRhs != rhs)
{
NotificationChain msgs = null;
if (rhs != null)
msgs = ((InternalEObject)rhs).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.OR_EXPRESSION__RHS, null, msgs);
if (newRhs != null)
msgs = ((InternalEObject)newRhs).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ThingMLPackage.OR_EXPRESSION__RHS, null, msgs);
msgs = basicSetRhs(newRhs, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ThingMLPackage.OR_EXPRESSION__RHS, newRhs, newRhs));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ThingMLPackage.OR_EXPRESSION__LHS:
return basicSetLhs(null, msgs);
case ThingMLPackage.OR_EXPRESSION__RHS:
return basicSetRhs(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 ThingMLPackage.OR_EXPRESSION__LHS:
return getLhs();
case ThingMLPackage.OR_EXPRESSION__RHS:
return getRhs();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ThingMLPackage.OR_EXPRESSION__LHS:
setLhs((Expression)newValue);
return;
case ThingMLPackage.OR_EXPRESSION__RHS:
setRhs((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ThingMLPackage.OR_EXPRESSION__LHS:
setLhs((Expression)null);
return;
case ThingMLPackage.OR_EXPRESSION__RHS:
setRhs((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ThingMLPackage.OR_EXPRESSION__LHS:
return lhs != null;
case ThingMLPackage.OR_EXPRESSION__RHS:
return rhs != null;
}
return super.eIsSet(featureID);
}
} //OrExpressionImpl