/******************************************************************************* * Copyright (c) 2010 Martin Schnabel <mb0@mb0.org>. * 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 ******************************************************************************/ package org.axdt.asdoc.model.impl; import org.axdt.asdoc.AsdocEPackage; import org.axdt.asdoc.model.AsdocField; import org.axdt.avm.model.AvmTypeReference; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Doc Field</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.axdt.asdoc.model.impl.AsdocFieldImpl#isConstant <em>Constant</em>}</li> * <li>{@link org.axdt.asdoc.model.impl.AsdocFieldImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class AsdocFieldImpl extends AsdocMemberImpl implements AsdocField { /** * The default value of the '{@link #isConstant() <em>Constant</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isConstant() * @generated * @ordered */ protected static final boolean CONSTANT_EDEFAULT = false; /** * The flag representing the value of the '{@link #isConstant() <em>Constant</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isConstant() * @generated * @ordered */ protected static final int CONSTANT_EFLAG = 1 << 1; /** * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected AvmTypeReference type; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AsdocFieldImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AsdocEPackage.Literals.ASDOC_FIELD; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isConstant() { return (flags & CONSTANT_EFLAG) != 0; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConstant(boolean newConstant) { boolean oldConstant = (flags & CONSTANT_EFLAG) != 0; if (newConstant) flags |= CONSTANT_EFLAG; else flags &= ~CONSTANT_EFLAG; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AsdocEPackage.ASDOC_FIELD__CONSTANT, oldConstant, newConstant)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AvmTypeReference getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetType(AvmTypeReference newType, NotificationChain msgs) { AvmTypeReference oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AsdocEPackage.ASDOC_FIELD__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(AvmTypeReference newType) { if (newType != type) { NotificationChain msgs = null; if (type != null) msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AsdocEPackage.ASDOC_FIELD__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AsdocEPackage.ASDOC_FIELD__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AsdocEPackage.ASDOC_FIELD__TYPE, newType, newType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AsdocEPackage.ASDOC_FIELD__TYPE: return basicSetType(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 AsdocEPackage.ASDOC_FIELD__CONSTANT: return isConstant(); case AsdocEPackage.ASDOC_FIELD__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AsdocEPackage.ASDOC_FIELD__CONSTANT: setConstant((Boolean)newValue); return; case AsdocEPackage.ASDOC_FIELD__TYPE: setType((AvmTypeReference)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AsdocEPackage.ASDOC_FIELD__CONSTANT: setConstant(CONSTANT_EDEFAULT); return; case AsdocEPackage.ASDOC_FIELD__TYPE: setType((AvmTypeReference)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AsdocEPackage.ASDOC_FIELD__CONSTANT: return ((flags & CONSTANT_EFLAG) != 0) != CONSTANT_EDEFAULT; case AsdocEPackage.ASDOC_FIELD__TYPE: return type != 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(" (constant: "); result.append((flags & CONSTANT_EFLAG) != 0); result.append(')'); return result.toString(); } } //AsdocFieldImpl