blob: df80bb68ff0557609ebb5751faa772207e37e305 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http{//www.eclipse.org/legal/epl-v10.html
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors{
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.table.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.xtext.table.TableDSLPackage;
import org.eclipse.osbp.xtext.table.TableRangeElement;
import org.eclipse.osbp.xtext.table.TableStringLookup;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Table String Lookup</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.xtext.table.impl.TableStringLookupImpl#getLookupValue <em>Lookup Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.table.impl.TableStringLookupImpl#getDiscrete <em>Discrete</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TableStringLookupImpl extends TableLazyResolverImpl implements TableStringLookup {
/**
* The default value of the '{@link #getLookupValue() <em>Lookup Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLookupValue()
* @generated
* @ordered
*/
protected static final String LOOKUP_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getLookupValue() <em>Lookup Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLookupValue()
* @generated
* @ordered
*/
protected String lookupValue = LOOKUP_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getDiscrete() <em>Discrete</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDiscrete()
* @generated
* @ordered
*/
protected TableRangeElement discrete;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TableStringLookupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TableDSLPackage.Literals.TABLE_STRING_LOOKUP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLookupValue() {
return lookupValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLookupValue(String newLookupValue) {
String oldLookupValue = lookupValue;
lookupValue = newLookupValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE_STRING_LOOKUP__LOOKUP_VALUE, oldLookupValue, lookupValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TableRangeElement getDiscrete() {
return discrete;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDiscrete(TableRangeElement newDiscrete, NotificationChain msgs) {
TableRangeElement oldDiscrete = discrete;
discrete = newDiscrete;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE, oldDiscrete, newDiscrete);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDiscrete(TableRangeElement newDiscrete) {
if (newDiscrete != discrete) {
NotificationChain msgs = null;
if (discrete != null)
msgs = ((InternalEObject)discrete).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE, null, msgs);
if (newDiscrete != null)
msgs = ((InternalEObject)newDiscrete).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE, null, msgs);
msgs = basicSetDiscrete(newDiscrete, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE, newDiscrete, newDiscrete));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE:
return basicSetDiscrete(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 TableDSLPackage.TABLE_STRING_LOOKUP__LOOKUP_VALUE:
return getLookupValue();
case TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE:
return getDiscrete();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TableDSLPackage.TABLE_STRING_LOOKUP__LOOKUP_VALUE:
setLookupValue((String)newValue);
return;
case TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE:
setDiscrete((TableRangeElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TableDSLPackage.TABLE_STRING_LOOKUP__LOOKUP_VALUE:
setLookupValue(LOOKUP_VALUE_EDEFAULT);
return;
case TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE:
setDiscrete((TableRangeElement)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TableDSLPackage.TABLE_STRING_LOOKUP__LOOKUP_VALUE:
return LOOKUP_VALUE_EDEFAULT == null ? lookupValue != null : !LOOKUP_VALUE_EDEFAULT.equals(lookupValue);
case TableDSLPackage.TABLE_STRING_LOOKUP__DISCRETE:
return discrete != 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(" (lookupValue: ");
result.append(lookupValue);
result.append(')');
return result.toString();
}
} //TableStringLookupImpl