blob: b34bc080b2e9ef78ff6496f91efba80f3a9aa69b [file] [log] [blame]
/**
* Copyright (c) 2014, Loetz GmbH&Co.KG (Heidelberg)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.datainterchange.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.osbp.dsl.semantic.entity.LEntityFeature;
import org.eclipse.osbp.xtext.datainterchange.DataDSLPackage;
import org.eclipse.osbp.xtext.datainterchange.DataInterchangeLookupFilterCondition;
import org.eclipse.osbp.xtext.datainterchange.DataInterchangeLookupFilterOperand;
import org.eclipse.osbp.xtext.datainterchange.Junction;
import org.eclipse.osbp.xtext.datainterchange.Operator;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Interchange Lookup Filter Condition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeLookupFilterConditionImpl#getRefProperty <em>Ref Property</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeLookupFilterConditionImpl#getOperator <em>Operator</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeLookupFilterConditionImpl#getOperand <em>Operand</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeLookupFilterConditionImpl#getOperator2 <em>Operator2</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeLookupFilterConditionImpl#getSubcondition <em>Subcondition</em>}</li>
* </ul>
*
* @generated
*/
public class DataInterchangeLookupFilterConditionImpl extends DataInterchangeLazyResolverImpl implements DataInterchangeLookupFilterCondition {
/**
* The cached value of the '{@link #getRefProperty() <em>Ref Property</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRefProperty()
* @generated
* @ordered
*/
protected LEntityFeature refProperty;
/**
* The default value of the '{@link #getOperator() <em>Operator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator()
* @generated
* @ordered
*/
protected static final Operator OPERATOR_EDEFAULT = Operator.EQUALS;
/**
* The cached value of the '{@link #getOperator() <em>Operator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator()
* @generated
* @ordered
*/
protected Operator operator = OPERATOR_EDEFAULT;
/**
* The cached value of the '{@link #getOperand() <em>Operand</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperand()
* @generated
* @ordered
*/
protected DataInterchangeLookupFilterOperand operand;
/**
* The default value of the '{@link #getOperator2() <em>Operator2</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator2()
* @generated
* @ordered
*/
protected static final Junction OPERATOR2_EDEFAULT = Junction.AND;
/**
* The cached value of the '{@link #getOperator2() <em>Operator2</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator2()
* @generated
* @ordered
*/
protected Junction operator2 = OPERATOR2_EDEFAULT;
/**
* The cached value of the '{@link #getSubcondition() <em>Subcondition</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSubcondition()
* @generated
* @ordered
*/
protected DataInterchangeLookupFilterCondition subcondition;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataInterchangeLookupFilterConditionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DataDSLPackage.Literals.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityFeature getRefProperty() {
if (refProperty != null && refProperty.eIsProxy()) {
InternalEObject oldRefProperty = (InternalEObject)refProperty;
refProperty = (LEntityFeature)eResolveProxy(oldRefProperty);
if (refProperty != oldRefProperty) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY, oldRefProperty, refProperty));
}
}
return refProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityFeature basicGetRefProperty() {
return refProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRefProperty(LEntityFeature newRefProperty) {
LEntityFeature oldRefProperty = refProperty;
refProperty = newRefProperty;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY, oldRefProperty, refProperty));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operator getOperator() {
return operator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperator(Operator newOperator) {
Operator oldOperator = operator;
operator = newOperator == null ? OPERATOR_EDEFAULT : newOperator;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR, oldOperator, operator));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataInterchangeLookupFilterOperand getOperand() {
return operand;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOperand(DataInterchangeLookupFilterOperand newOperand, NotificationChain msgs) {
DataInterchangeLookupFilterOperand oldOperand = operand;
operand = newOperand;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND, oldOperand, newOperand);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperand(DataInterchangeLookupFilterOperand newOperand) {
if (newOperand != operand) {
NotificationChain msgs = null;
if (operand != null)
msgs = ((InternalEObject)operand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND, null, msgs);
if (newOperand != null)
msgs = ((InternalEObject)newOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND, null, msgs);
msgs = basicSetOperand(newOperand, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND, newOperand, newOperand));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Junction getOperator2() {
return operator2;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperator2(Junction newOperator2) {
Junction oldOperator2 = operator2;
operator2 = newOperator2 == null ? OPERATOR2_EDEFAULT : newOperator2;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR2, oldOperator2, operator2));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataInterchangeLookupFilterCondition getSubcondition() {
return subcondition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSubcondition(DataInterchangeLookupFilterCondition newSubcondition, NotificationChain msgs) {
DataInterchangeLookupFilterCondition oldSubcondition = subcondition;
subcondition = newSubcondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION, oldSubcondition, newSubcondition);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSubcondition(DataInterchangeLookupFilterCondition newSubcondition) {
if (newSubcondition != subcondition) {
NotificationChain msgs = null;
if (subcondition != null)
msgs = ((InternalEObject)subcondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION, null, msgs);
if (newSubcondition != null)
msgs = ((InternalEObject)newSubcondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION, null, msgs);
msgs = basicSetSubcondition(newSubcondition, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION, newSubcondition, newSubcondition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND:
return basicSetOperand(null, msgs);
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION:
return basicSetSubcondition(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 DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY:
if (resolve) return getRefProperty();
return basicGetRefProperty();
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR:
return getOperator();
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND:
return getOperand();
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR2:
return getOperator2();
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION:
return getSubcondition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY:
setRefProperty((LEntityFeature)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR:
setOperator((Operator)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND:
setOperand((DataInterchangeLookupFilterOperand)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR2:
setOperator2((Junction)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION:
setSubcondition((DataInterchangeLookupFilterCondition)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY:
setRefProperty((LEntityFeature)null);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR:
setOperator(OPERATOR_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND:
setOperand((DataInterchangeLookupFilterOperand)null);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR2:
setOperator2(OPERATOR2_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION:
setSubcondition((DataInterchangeLookupFilterCondition)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__REF_PROPERTY:
return refProperty != null;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR:
return operator != OPERATOR_EDEFAULT;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERAND:
return operand != null;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__OPERATOR2:
return operator2 != OPERATOR2_EDEFAULT;
case DataDSLPackage.DATA_INTERCHANGE_LOOKUP_FILTER_CONDITION__SUBCONDITION:
return subcondition != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (operator: ");
result.append(operator);
result.append(", operator2: ");
result.append(operator2);
result.append(')');
return result.toString();
}
} //DataInterchangeLookupFilterConditionImpl