blob: e9b43c2f0f76d67342ae39196dcecdb39d3c1f3a [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 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.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.Table;
import org.eclipse.osbp.xtext.table.TableDSLPackage;
import org.eclipse.osbp.xtext.table.TableOption;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Table</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.table.impl.TableImpl#isDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.table.impl.TableImpl#getDescriptionValue <em>Description Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.table.impl.TableImpl#getTabletype <em>Tabletype</em>}</li>
* </ul>
*
* @generated
*/
public class TableImpl extends TableBaseImpl implements Table {
/**
* The default value of the '{@link #isDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDescription()
* @generated
* @ordered
*/
protected static final boolean DESCRIPTION_EDEFAULT = false;
/**
* The cached value of the '{@link #isDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDescription()
* @generated
* @ordered
*/
protected boolean description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getDescriptionValue() <em>Description Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptionValue()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescriptionValue() <em>Description Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptionValue()
* @generated
* @ordered
*/
protected String descriptionValue = DESCRIPTION_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getTabletype() <em>Tabletype</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTabletype()
* @generated
* @ordered
*/
protected TableOption tabletype;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TableImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TableDSLPackage.Literals.TABLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(boolean newDescription) {
boolean oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescriptionValue() {
return descriptionValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescriptionValue(String newDescriptionValue) {
String oldDescriptionValue = descriptionValue;
descriptionValue = newDescriptionValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE__DESCRIPTION_VALUE, oldDescriptionValue, descriptionValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TableOption getTabletype() {
return tabletype;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTabletype(TableOption newTabletype, NotificationChain msgs) {
TableOption oldTabletype = tabletype;
tabletype = newTabletype;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE__TABLETYPE, oldTabletype, newTabletype);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTabletype(TableOption newTabletype) {
if (newTabletype != tabletype) {
NotificationChain msgs = null;
if (tabletype != null)
msgs = ((InternalEObject)tabletype).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TableDSLPackage.TABLE__TABLETYPE, null, msgs);
if (newTabletype != null)
msgs = ((InternalEObject)newTabletype).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TableDSLPackage.TABLE__TABLETYPE, null, msgs);
msgs = basicSetTabletype(newTabletype, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TableDSLPackage.TABLE__TABLETYPE, newTabletype, newTabletype));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TableDSLPackage.TABLE__TABLETYPE:
return basicSetTabletype(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__DESCRIPTION:
return isDescription();
case TableDSLPackage.TABLE__DESCRIPTION_VALUE:
return getDescriptionValue();
case TableDSLPackage.TABLE__TABLETYPE:
return getTabletype();
}
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__DESCRIPTION:
setDescription((Boolean)newValue);
return;
case TableDSLPackage.TABLE__DESCRIPTION_VALUE:
setDescriptionValue((String)newValue);
return;
case TableDSLPackage.TABLE__TABLETYPE:
setTabletype((TableOption)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TableDSLPackage.TABLE__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case TableDSLPackage.TABLE__DESCRIPTION_VALUE:
setDescriptionValue(DESCRIPTION_VALUE_EDEFAULT);
return;
case TableDSLPackage.TABLE__TABLETYPE:
setTabletype((TableOption)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TableDSLPackage.TABLE__DESCRIPTION:
return description != DESCRIPTION_EDEFAULT;
case TableDSLPackage.TABLE__DESCRIPTION_VALUE:
return DESCRIPTION_VALUE_EDEFAULT == null ? descriptionValue != null : !DESCRIPTION_VALUE_EDEFAULT.equals(descriptionValue);
case TableDSLPackage.TABLE__TABLETYPE:
return tabletype != 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(" (description: ");
result.append(description);
result.append(", descriptionValue: ");
result.append(descriptionValue);
result.append(')');
return result.toString();
}
} //TableImpl