| /** |
| * 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.LEntityReference; |
| |
| import org.eclipse.osbp.xtext.datainterchange.DataDSLPackage; |
| import org.eclipse.osbp.xtext.datainterchange.Junction; |
| import org.eclipse.osbp.xtext.datainterchange.Operator; |
| import org.eclipse.osbp.xtext.datainterchange.ReferenceFilter; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Reference Filter</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.ReferenceFilterImpl#getRefEntity <em>Ref Entity</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.ReferenceFilterImpl#getOperator <em>Operator</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.ReferenceFilterImpl#getValue <em>Value</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.ReferenceFilterImpl#getOperator2 <em>Operator2</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.ReferenceFilterImpl#getSubCondition <em>Sub Condition</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ReferenceFilterImpl extends DataInterchangeLazyResolverImpl implements ReferenceFilter { |
| /** |
| * The cached value of the '{@link #getRefEntity() <em>Ref Entity</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRefEntity() |
| * @generated |
| * @ordered |
| */ |
| protected LEntityReference refEntity; |
| |
| /** |
| * 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 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 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>Sub Condition</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSubCondition() |
| * @generated |
| * @ordered |
| */ |
| protected ReferenceFilter subCondition; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ReferenceFilterImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DataDSLPackage.Literals.REFERENCE_FILTER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntityReference getRefEntity() { |
| if (refEntity != null && refEntity.eIsProxy()) { |
| InternalEObject oldRefEntity = (InternalEObject)refEntity; |
| refEntity = (LEntityReference)eResolveProxy(oldRefEntity); |
| if (refEntity != oldRefEntity) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataDSLPackage.REFERENCE_FILTER__REF_ENTITY, oldRefEntity, refEntity)); |
| } |
| } |
| return refEntity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntityReference basicGetRefEntity() { |
| return refEntity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRefEntity(LEntityReference newRefEntity) { |
| LEntityReference oldRefEntity = refEntity; |
| refEntity = newRefEntity; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.REFERENCE_FILTER__REF_ENTITY, oldRefEntity, refEntity)); |
| } |
| |
| /** |
| * <!-- 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.REFERENCE_FILTER__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.REFERENCE_FILTER__VALUE, oldValue, value)); |
| } |
| |
| /** |
| * <!-- 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.REFERENCE_FILTER__OPERATOR2, oldOperator2, operator2)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReferenceFilter getSubCondition() { |
| return subCondition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSubCondition(ReferenceFilter newSubCondition, NotificationChain msgs) { |
| ReferenceFilter oldSubCondition = subCondition; |
| subCondition = newSubCondition; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION, oldSubCondition, newSubCondition); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSubCondition(ReferenceFilter newSubCondition) { |
| if (newSubCondition != subCondition) { |
| NotificationChain msgs = null; |
| if (subCondition != null) |
| msgs = ((InternalEObject)subCondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION, null, msgs); |
| if (newSubCondition != null) |
| msgs = ((InternalEObject)newSubCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION, null, msgs); |
| msgs = basicSetSubCondition(newSubCondition, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION, newSubCondition, newSubCondition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION: |
| 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.REFERENCE_FILTER__REF_ENTITY: |
| if (resolve) return getRefEntity(); |
| return basicGetRefEntity(); |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR: |
| return getOperator(); |
| case DataDSLPackage.REFERENCE_FILTER__VALUE: |
| return getValue(); |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR2: |
| return getOperator2(); |
| case DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION: |
| 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.REFERENCE_FILTER__REF_ENTITY: |
| setRefEntity((LEntityReference)newValue); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR: |
| setOperator((Operator)newValue); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__VALUE: |
| setValue((String)newValue); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR2: |
| setOperator2((Junction)newValue); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION: |
| setSubCondition((ReferenceFilter)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DataDSLPackage.REFERENCE_FILTER__REF_ENTITY: |
| setRefEntity((LEntityReference)null); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR: |
| setOperator(OPERATOR_EDEFAULT); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__VALUE: |
| setValue(VALUE_EDEFAULT); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR2: |
| setOperator2(OPERATOR2_EDEFAULT); |
| return; |
| case DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION: |
| setSubCondition((ReferenceFilter)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DataDSLPackage.REFERENCE_FILTER__REF_ENTITY: |
| return refEntity != null; |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR: |
| return operator != OPERATOR_EDEFAULT; |
| case DataDSLPackage.REFERENCE_FILTER__VALUE: |
| return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); |
| case DataDSLPackage.REFERENCE_FILTER__OPERATOR2: |
| return operator2 != OPERATOR2_EDEFAULT; |
| case DataDSLPackage.REFERENCE_FILTER__SUB_CONDITION: |
| 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(); |
| } |
| |
| } //ReferenceFilterImpl |