blob: 794cb63e857dbe82a49d3d01c139415bbd468d39 [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:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.chart.impl;
import org.eclipse.emf.common.notify.Notification;
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.ChartAxis;
import org.eclipse.osbp.xtext.chart.ChartDSLPackage;
import org.eclipse.osbp.xtext.chart.RenderTypeEnum;
import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Chart Axis</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getAxis <em>Axis</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getRenderType <em>Render Type</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#isShortLabel <em>Short Label</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.chart.impl.ChartAxisImpl#getAngle <em>Angle</em>}</li>
* </ul>
*
* @generated
*/
public class ChartAxisImpl extends ChartLazyResolverImpl implements ChartAxis {
/**
* The cached value of the '{@link #getAxis() <em>Axis</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAxis()
* @generated
* @ordered
*/
protected DatamartAxis axis;
/**
* The default value of the '{@link #getRenderType() <em>Render Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRenderType()
* @generated
* @ordered
*/
protected static final RenderTypeEnum RENDER_TYPE_EDEFAULT = RenderTypeEnum.CATEGORY;
/**
* The cached value of the '{@link #getRenderType() <em>Render Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRenderType()
* @generated
* @ordered
*/
protected RenderTypeEnum renderType = RENDER_TYPE_EDEFAULT;
/**
* The default value of the '{@link #isShortLabel() <em>Short Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShortLabel()
* @generated
* @ordered
*/
protected static final boolean SHORT_LABEL_EDEFAULT = false;
/**
* The cached value of the '{@link #isShortLabel() <em>Short Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShortLabel()
* @generated
* @ordered
*/
protected boolean shortLabel = SHORT_LABEL_EDEFAULT;
/**
* The default value of the '{@link #getAngle() <em>Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAngle()
* @generated
* @ordered
*/
protected static final int ANGLE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getAngle() <em>Angle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAngle()
* @generated
* @ordered
*/
protected int angle = ANGLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ChartAxisImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ChartDSLPackage.Literals.CHART_AXIS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis getAxis() {
if (axis != null && axis.eIsProxy()) {
InternalEObject oldAxis = (InternalEObject)axis;
axis = (DatamartAxis)eResolveProxy(oldAxis);
if (axis != oldAxis) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ChartDSLPackage.CHART_AXIS__AXIS, oldAxis, axis));
}
}
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis basicGetAxis() {
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAxis(DatamartAxis newAxis) {
DatamartAxis oldAxis = axis;
axis = newAxis;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__AXIS, oldAxis, axis));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RenderTypeEnum getRenderType() {
return renderType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRenderType(RenderTypeEnum newRenderType) {
RenderTypeEnum oldRenderType = renderType;
renderType = newRenderType == null ? RENDER_TYPE_EDEFAULT : newRenderType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__RENDER_TYPE, oldRenderType, renderType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isShortLabel() {
return shortLabel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setShortLabel(boolean newShortLabel) {
boolean oldShortLabel = shortLabel;
shortLabel = newShortLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__SHORT_LABEL, oldShortLabel, shortLabel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getAngle() {
return angle;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAngle(int newAngle) {
int oldAngle = angle;
angle = newAngle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ChartDSLPackage.CHART_AXIS__ANGLE, oldAngle, angle));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ChartDSLPackage.CHART_AXIS__AXIS:
if (resolve) return getAxis();
return basicGetAxis();
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
return getRenderType();
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
return isShortLabel();
case ChartDSLPackage.CHART_AXIS__ANGLE:
return getAngle();
}
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_AXIS__AXIS:
setAxis((DatamartAxis)newValue);
return;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
setRenderType((RenderTypeEnum)newValue);
return;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
setShortLabel((Boolean)newValue);
return;
case ChartDSLPackage.CHART_AXIS__ANGLE:
setAngle((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ChartDSLPackage.CHART_AXIS__AXIS:
setAxis((DatamartAxis)null);
return;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
setRenderType(RENDER_TYPE_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
setShortLabel(SHORT_LABEL_EDEFAULT);
return;
case ChartDSLPackage.CHART_AXIS__ANGLE:
setAngle(ANGLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ChartDSLPackage.CHART_AXIS__AXIS:
return axis != null;
case ChartDSLPackage.CHART_AXIS__RENDER_TYPE:
return renderType != RENDER_TYPE_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__SHORT_LABEL:
return shortLabel != SHORT_LABEL_EDEFAULT;
case ChartDSLPackage.CHART_AXIS__ANGLE:
return angle != ANGLE_EDEFAULT;
}
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(" (renderType: ");
result.append(renderType);
result.append(", shortLabel: ");
result.append(shortLabel);
result.append(", angle: ");
result.append(angle);
result.append(')');
return result.toString();
}
} //ChartAxisImpl