blob: 0742939eb149c1ded7e13990935f618a8d255db1 [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.ConditionAndOperator1;
import org.eclipse.osbp.xtext.datainterchange.ConditionAndOperator2;
import org.eclipse.osbp.xtext.datainterchange.DataDSLPackage;
import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFilterCondition;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Interchange Filter Condition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFilterConditionImpl#getRefProperty <em>Ref Property</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFilterConditionImpl#getOperator <em>Operator</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFilterConditionImpl#getValue <em>Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFilterConditionImpl#getOperator2 <em>Operator2</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFilterConditionImpl#getSubcondition <em>Subcondition</em>}</li>
* </ul>
*
* @generated
*/
public class DataInterchangeFilterConditionImpl extends DataInterchangeLazyResolverImpl implements DataInterchangeFilterCondition {
/**
* 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 ConditionAndOperator1 OPERATOR_EDEFAULT = ConditionAndOperator1.EQUALS;
/**
* The cached value of the '{@link #getOperator() <em>Operator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator()
* @generated
* @ordered
*/
protected ConditionAndOperator1 operator = OPERATOR_EDEFAULT;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getOperator2() <em>Operator2</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator2()
* @generated
* @ordered
*/
protected static final ConditionAndOperator2 OPERATOR2_EDEFAULT = ConditionAndOperator2.AND;
/**
* The cached value of the '{@link #getOperator2() <em>Operator2</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOperator2()
* @generated
* @ordered
*/
protected ConditionAndOperator2 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 DataInterchangeFilterCondition subcondition;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataInterchangeFilterConditionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DataDSLPackage.Literals.DATA_INTERCHANGE_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_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_FILTER_CONDITION__REF_PROPERTY, oldRefProperty, refProperty));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ConditionAndOperator1 getOperator() {
return operator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperator(ConditionAndOperator1 newOperator) {
ConditionAndOperator1 oldOperator = operator;
operator = newOperator == null ? OPERATOR_EDEFAULT : newOperator;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR, oldOperator, operator));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ConditionAndOperator2 getOperator2() {
return operator2;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOperator2(ConditionAndOperator2 newOperator2) {
ConditionAndOperator2 oldOperator2 = operator2;
operator2 = newOperator2 == null ? OPERATOR2_EDEFAULT : newOperator2;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR2, oldOperator2, operator2));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataInterchangeFilterCondition getSubcondition() {
return subcondition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSubcondition(DataInterchangeFilterCondition newSubcondition, NotificationChain msgs) {
DataInterchangeFilterCondition oldSubcondition = subcondition;
subcondition = newSubcondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_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(DataInterchangeFilterCondition newSubcondition) {
if (newSubcondition != subcondition) {
NotificationChain msgs = null;
if (subcondition != null)
msgs = ((InternalEObject)subcondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__SUBCONDITION, null, msgs);
if (newSubcondition != null)
msgs = ((InternalEObject)newSubcondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.DATA_INTERCHANGE_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_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_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_FILTER_CONDITION__REF_PROPERTY:
if (resolve) return getRefProperty();
return basicGetRefProperty();
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR:
return getOperator();
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__VALUE:
return getValue();
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR2:
return getOperator2();
case DataDSLPackage.DATA_INTERCHANGE_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_FILTER_CONDITION__REF_PROPERTY:
setRefProperty((LEntityFeature)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR:
setOperator((ConditionAndOperator1)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__VALUE:
setValue((String)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR2:
setOperator2((ConditionAndOperator2)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__SUBCONDITION:
setSubcondition((DataInterchangeFilterCondition)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_FILTER_CONDITION__REF_PROPERTY:
setRefProperty((LEntityFeature)null);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR:
setOperator(OPERATOR_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__VALUE:
setValue(VALUE_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR2:
setOperator2(OPERATOR2_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__SUBCONDITION:
setSubcondition((DataInterchangeFilterCondition)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__REF_PROPERTY:
return refProperty != null;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR:
return operator != OPERATOR_EDEFAULT;
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case DataDSLPackage.DATA_INTERCHANGE_FILTER_CONDITION__OPERATOR2:
return operator2 != OPERATOR2_EDEFAULT;
case DataDSLPackage.DATA_INTERCHANGE_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(", value: ");
result.append(value);
result.append(", operator2: ");
result.append(operator2);
result.append(')');
return result.toString();
}
} //DataInterchangeFilterConditionImpl