| /** |
| * 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.chart.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.chart.Chart; |
| import org.eclipse.osbp.xtext.chart.ChartDSLPackage; |
| import org.eclipse.osbp.xtext.chart.ChartDatamart; |
| import org.eclipse.osbp.xtext.chart.ChartOption; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Chart</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#isDescription <em>Description</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#getDescriptionValue <em>Description Value</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#isPolling <em>Polling</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#getPollingTime <em>Polling Time</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#getCharttype <em>Charttype</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartImpl#getSource <em>Source</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ChartImpl extends ChartBaseImpl implements Chart { |
| /** |
| * 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 default value of the '{@link #isPolling() <em>Polling</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isPolling() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean POLLING_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isPolling() <em>Polling</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isPolling() |
| * @generated |
| * @ordered |
| */ |
| protected boolean polling = POLLING_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getPollingTime() <em>Polling Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPollingTime() |
| * @generated |
| * @ordered |
| */ |
| protected static final int POLLING_TIME_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getPollingTime() <em>Polling Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPollingTime() |
| * @generated |
| * @ordered |
| */ |
| protected int pollingTime = POLLING_TIME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getCharttype() <em>Charttype</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCharttype() |
| * @generated |
| * @ordered |
| */ |
| protected ChartOption charttype; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected ChartDatamart source; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ChartImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ChartDSLPackage.Literals.CHART; |
| } |
| |
| /** |
| * <!-- 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, ChartDSLPackage.CHART__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, ChartDSLPackage.CHART__DESCRIPTION_VALUE, oldDescriptionValue, descriptionValue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isPolling() { |
| return polling; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPolling(boolean newPolling) { |
| boolean oldPolling = polling; |
| polling = newPolling; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__POLLING, oldPolling, polling)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getPollingTime() { |
| return pollingTime; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPollingTime(int newPollingTime) { |
| int oldPollingTime = pollingTime; |
| pollingTime = newPollingTime; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__POLLING_TIME, oldPollingTime, pollingTime)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ChartOption getCharttype() { |
| return charttype; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetCharttype(ChartOption newCharttype, NotificationChain msgs) { |
| ChartOption oldCharttype = charttype; |
| charttype = newCharttype; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__CHARTTYPE, oldCharttype, newCharttype); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCharttype(ChartOption newCharttype) { |
| if (newCharttype != charttype) { |
| NotificationChain msgs = null; |
| if (charttype != null) |
| msgs = ((InternalEObject)charttype).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ChartDSLPackage.CHART__CHARTTYPE, null, msgs); |
| if (newCharttype != null) |
| msgs = ((InternalEObject)newCharttype).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ChartDSLPackage.CHART__CHARTTYPE, null, msgs); |
| msgs = basicSetCharttype(newCharttype, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__CHARTTYPE, newCharttype, newCharttype)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ChartDatamart getSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSource(ChartDatamart newSource, NotificationChain msgs) { |
| ChartDatamart oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__SOURCE, oldSource, newSource); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSource(ChartDatamart newSource) { |
| if (newSource != source) { |
| NotificationChain msgs = null; |
| if (source != null) |
| msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ChartDSLPackage.CHART__SOURCE, null, msgs); |
| if (newSource != null) |
| msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ChartDSLPackage.CHART__SOURCE, null, msgs); |
| msgs = basicSetSource(newSource, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART__SOURCE, newSource, newSource)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART__CHARTTYPE: |
| return basicSetCharttype(null, msgs); |
| case ChartDSLPackage.CHART__SOURCE: |
| return basicSetSource(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 ChartDSLPackage.CHART__DESCRIPTION: |
| return isDescription(); |
| case ChartDSLPackage.CHART__DESCRIPTION_VALUE: |
| return getDescriptionValue(); |
| case ChartDSLPackage.CHART__POLLING: |
| return isPolling(); |
| case ChartDSLPackage.CHART__POLLING_TIME: |
| return getPollingTime(); |
| case ChartDSLPackage.CHART__CHARTTYPE: |
| return getCharttype(); |
| case ChartDSLPackage.CHART__SOURCE: |
| return getSource(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART__DESCRIPTION: |
| setDescription((Boolean)newValue); |
| return; |
| case ChartDSLPackage.CHART__DESCRIPTION_VALUE: |
| setDescriptionValue((String)newValue); |
| return; |
| case ChartDSLPackage.CHART__POLLING: |
| setPolling((Boolean)newValue); |
| return; |
| case ChartDSLPackage.CHART__POLLING_TIME: |
| setPollingTime((Integer)newValue); |
| return; |
| case ChartDSLPackage.CHART__CHARTTYPE: |
| setCharttype((ChartOption)newValue); |
| return; |
| case ChartDSLPackage.CHART__SOURCE: |
| setSource((ChartDatamart)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART__DESCRIPTION: |
| setDescription(DESCRIPTION_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART__DESCRIPTION_VALUE: |
| setDescriptionValue(DESCRIPTION_VALUE_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART__POLLING: |
| setPolling(POLLING_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART__POLLING_TIME: |
| setPollingTime(POLLING_TIME_EDEFAULT); |
| return; |
| case ChartDSLPackage.CHART__CHARTTYPE: |
| setCharttype((ChartOption)null); |
| return; |
| case ChartDSLPackage.CHART__SOURCE: |
| setSource((ChartDatamart)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ChartDSLPackage.CHART__DESCRIPTION: |
| return description != DESCRIPTION_EDEFAULT; |
| case ChartDSLPackage.CHART__DESCRIPTION_VALUE: |
| return DESCRIPTION_VALUE_EDEFAULT == null ? descriptionValue != null : !DESCRIPTION_VALUE_EDEFAULT.equals(descriptionValue); |
| case ChartDSLPackage.CHART__POLLING: |
| return polling != POLLING_EDEFAULT; |
| case ChartDSLPackage.CHART__POLLING_TIME: |
| return pollingTime != POLLING_TIME_EDEFAULT; |
| case ChartDSLPackage.CHART__CHARTTYPE: |
| return charttype != null; |
| case ChartDSLPackage.CHART__SOURCE: |
| return source != 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(", polling: "); |
| result.append(polling); |
| result.append(", pollingTime: "); |
| result.append(pollingTime); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ChartImpl |