| /** |
| * Copyright (c) 2011, 2016 - Lunifera GmbH (Wien), 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: |
| * Florian Pirchner - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.dsl.semantic.common.types.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.osbp.dsl.semantic.common.types.LEnumLiteral; |
| import org.eclipse.osbp.dsl.semantic.common.types.OSBPTypesPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>LEnum Literal</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LEnumLiteralImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LEnumLiteralImpl#isDefault <em>Default</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LEnumLiteralImpl#isNull <em>Null</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LEnumLiteralImpl#getValue <em>Value</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class LEnumLiteralImpl extends LLazyResolverImpl implements LEnumLiteral { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isDefault() <em>Default</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isDefault() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean DEFAULT_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isDefault() <em>Default</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isDefault() |
| * @generated |
| * @ordered |
| */ |
| protected boolean default_ = DEFAULT_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #isNull() <em>Null</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isNull() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean NULL_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isNull() <em>Null</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isNull() |
| * @generated |
| * @ordered |
| */ |
| protected boolean null_ = NULL_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 int VALUE_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected int value = VALUE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LEnumLiteralImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return OSBPTypesPackage.Literals.LENUM_LITERAL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LENUM_LITERAL__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isDefault() { |
| return default_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDefault(boolean newDefault) { |
| boolean oldDefault = default_; |
| default_ = newDefault; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LENUM_LITERAL__DEFAULT, oldDefault, default_)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isNull() { |
| return null_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setNull(boolean newNull) { |
| boolean oldNull = null_; |
| null_ = newNull; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LENUM_LITERAL__NULL, oldNull, null_)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValue(int newValue) { |
| int oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LENUM_LITERAL__VALUE, oldValue, value)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case OSBPTypesPackage.LENUM_LITERAL__NAME: |
| return getName(); |
| case OSBPTypesPackage.LENUM_LITERAL__DEFAULT: |
| return isDefault(); |
| case OSBPTypesPackage.LENUM_LITERAL__NULL: |
| return isNull(); |
| case OSBPTypesPackage.LENUM_LITERAL__VALUE: |
| return getValue(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case OSBPTypesPackage.LENUM_LITERAL__NAME: |
| setName((String)newValue); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__DEFAULT: |
| setDefault((Boolean)newValue); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__NULL: |
| setNull((Boolean)newValue); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__VALUE: |
| setValue((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case OSBPTypesPackage.LENUM_LITERAL__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__DEFAULT: |
| setDefault(DEFAULT_EDEFAULT); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__NULL: |
| setNull(NULL_EDEFAULT); |
| return; |
| case OSBPTypesPackage.LENUM_LITERAL__VALUE: |
| setValue(VALUE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case OSBPTypesPackage.LENUM_LITERAL__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case OSBPTypesPackage.LENUM_LITERAL__DEFAULT: |
| return default_ != DEFAULT_EDEFAULT; |
| case OSBPTypesPackage.LENUM_LITERAL__NULL: |
| return null_ != NULL_EDEFAULT; |
| case OSBPTypesPackage.LENUM_LITERAL__VALUE: |
| return value != VALUE_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(" (name: "); |
| result.append(name); |
| result.append(", default: "); |
| result.append(default_); |
| result.append(", null: "); |
| result.append(null_); |
| result.append(", value: "); |
| result.append(value); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LEnumLiteralImpl |