/******************************************************************************* * Copyright (c) 2006-2012 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * 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 * * Contributors: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation ******************************************************************************/ /** * <copyright> * </copyright> * * $Id$ */ package org.oasisopen.names.tc.opendocument.xmlns.text.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.emf.ecore.impl.EObjectImpl; import org.oasisopen.names.tc.opendocument.xmlns.text.IndexBodyType; import org.oasisopen.names.tc.opendocument.xmlns.text.TableOfContentSourceType; import org.oasisopen.names.tc.opendocument.xmlns.text.TableOfContentType; import org.oasisopen.names.tc.opendocument.xmlns.text.TextPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Table Of Content Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getTableOfContentSource <em>Table Of Content Source</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getIndexBody <em>Index Body</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getName <em>Name</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getProtected <em>Protected</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getProtectionKey <em>Protection Key</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.text.impl.TableOfContentTypeImpl#getStyleName <em>Style Name</em>}</li> * </ul> * </p> * * @generated */ public class TableOfContentTypeImpl extends EObjectImpl implements TableOfContentType { /** * The cached value of the '{@link #getTableOfContentSource() <em>Table Of Content Source</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTableOfContentSource() * @generated * @ordered */ protected TableOfContentSourceType tableOfContentSource; /** * The cached value of the '{@link #getIndexBody() <em>Index Body</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIndexBody() * @generated * @ordered */ protected IndexBodyType indexBody; /** * 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 #getProtected() <em>Protected</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProtected() * @generated * @ordered */ protected static final org.oasisopen.names.tc.opendocument.xmlns.text.Boolean PROTECTED_EDEFAULT = org.oasisopen.names.tc.opendocument.xmlns.text.Boolean.TRUE; /** * The cached value of the '{@link #getProtected() <em>Protected</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProtected() * @generated * @ordered */ protected org.oasisopen.names.tc.opendocument.xmlns.text.Boolean protected_ = PROTECTED_EDEFAULT; /** * This is true if the Protected attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean protectedESet; /** * The default value of the '{@link #getProtectionKey() <em>Protection Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProtectionKey() * @generated * @ordered */ protected static final String PROTECTION_KEY_EDEFAULT = null; /** * The cached value of the '{@link #getProtectionKey() <em>Protection Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProtectionKey() * @generated * @ordered */ protected String protectionKey = PROTECTION_KEY_EDEFAULT; /** * The default value of the '{@link #getStyleName() <em>Style Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStyleName() * @generated * @ordered */ protected static final String STYLE_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getStyleName() <em>Style Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStyleName() * @generated * @ordered */ protected String styleName = STYLE_NAME_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TableOfContentTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return TextPackage.eINSTANCE.getTableOfContentType(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TableOfContentSourceType getTableOfContentSource() { return tableOfContentSource; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTableOfContentSource(TableOfContentSourceType newTableOfContentSource, NotificationChain msgs) { TableOfContentSourceType oldTableOfContentSource = tableOfContentSource; tableOfContentSource = newTableOfContentSource; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE, oldTableOfContentSource, newTableOfContentSource); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTableOfContentSource(TableOfContentSourceType newTableOfContentSource) { if (newTableOfContentSource != tableOfContentSource) { NotificationChain msgs = null; if (tableOfContentSource != null) msgs = ((InternalEObject)tableOfContentSource).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE, null, msgs); if (newTableOfContentSource != null) msgs = ((InternalEObject)newTableOfContentSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE, null, msgs); msgs = basicSetTableOfContentSource(newTableOfContentSource, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE, newTableOfContentSource, newTableOfContentSource)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IndexBodyType getIndexBody() { return indexBody; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetIndexBody(IndexBodyType newIndexBody, NotificationChain msgs) { IndexBodyType oldIndexBody = indexBody; indexBody = newIndexBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY, oldIndexBody, newIndexBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIndexBody(IndexBodyType newIndexBody) { if (newIndexBody != indexBody) { NotificationChain msgs = null; if (indexBody != null) msgs = ((InternalEObject)indexBody).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY, null, msgs); if (newIndexBody != null) msgs = ((InternalEObject)newIndexBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY, null, msgs); msgs = basicSetIndexBody(newIndexBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY, newIndexBody, newIndexBody)); } /** * <!-- 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, TextPackage.TABLE_OF_CONTENT_TYPE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public org.oasisopen.names.tc.opendocument.xmlns.text.Boolean getProtected() { return protected_; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setProtected(org.oasisopen.names.tc.opendocument.xmlns.text.Boolean newProtected) { org.oasisopen.names.tc.opendocument.xmlns.text.Boolean oldProtected = protected_; protected_ = newProtected == null ? PROTECTED_EDEFAULT : newProtected; boolean oldProtectedESet = protectedESet; protectedESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED, oldProtected, protected_, !oldProtectedESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetProtected() { org.oasisopen.names.tc.opendocument.xmlns.text.Boolean oldProtected = protected_; boolean oldProtectedESet = protectedESet; protected_ = PROTECTED_EDEFAULT; protectedESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED, oldProtected, PROTECTED_EDEFAULT, oldProtectedESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetProtected() { return protectedESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getProtectionKey() { return protectionKey; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setProtectionKey(String newProtectionKey) { String oldProtectionKey = protectionKey; protectionKey = newProtectionKey; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTION_KEY, oldProtectionKey, protectionKey)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getStyleName() { return styleName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStyleName(String newStyleName) { String oldStyleName = styleName; styleName = newStyleName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TextPackage.TABLE_OF_CONTENT_TYPE__STYLE_NAME, oldStyleName, styleName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE: return basicSetTableOfContentSource(null, msgs); case TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY: return basicSetIndexBody(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 TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE: return getTableOfContentSource(); case TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY: return getIndexBody(); case TextPackage.TABLE_OF_CONTENT_TYPE__NAME: return getName(); case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED: return getProtected(); case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTION_KEY: return getProtectionKey(); case TextPackage.TABLE_OF_CONTENT_TYPE__STYLE_NAME: return getStyleName(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE: setTableOfContentSource((TableOfContentSourceType)newValue); return; case TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY: setIndexBody((IndexBodyType)newValue); return; case TextPackage.TABLE_OF_CONTENT_TYPE__NAME: setName((String)newValue); return; case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED: setProtected((org.oasisopen.names.tc.opendocument.xmlns.text.Boolean)newValue); return; case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTION_KEY: setProtectionKey((String)newValue); return; case TextPackage.TABLE_OF_CONTENT_TYPE__STYLE_NAME: setStyleName((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE: setTableOfContentSource((TableOfContentSourceType)null); return; case TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY: setIndexBody((IndexBodyType)null); return; case TextPackage.TABLE_OF_CONTENT_TYPE__NAME: setName(NAME_EDEFAULT); return; case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED: unsetProtected(); return; case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTION_KEY: setProtectionKey(PROTECTION_KEY_EDEFAULT); return; case TextPackage.TABLE_OF_CONTENT_TYPE__STYLE_NAME: setStyleName(STYLE_NAME_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TextPackage.TABLE_OF_CONTENT_TYPE__TABLE_OF_CONTENT_SOURCE: return tableOfContentSource != null; case TextPackage.TABLE_OF_CONTENT_TYPE__INDEX_BODY: return indexBody != null; case TextPackage.TABLE_OF_CONTENT_TYPE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTED: return isSetProtected(); case TextPackage.TABLE_OF_CONTENT_TYPE__PROTECTION_KEY: return PROTECTION_KEY_EDEFAULT == null ? protectionKey != null : !PROTECTION_KEY_EDEFAULT.equals(protectionKey); case TextPackage.TABLE_OF_CONTENT_TYPE__STYLE_NAME: return STYLE_NAME_EDEFAULT == null ? styleName != null : !STYLE_NAME_EDEFAULT.equals(styleName); } 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(", protected: "); if (protectedESet) result.append(protected_); else result.append("<unset>"); result.append(", protectionKey: "); result.append(protectionKey); result.append(", styleName: "); result.append(styleName); result.append(')'); return result.toString(); } } //TableOfContentTypeImpl