/******************************************************************************* * 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.office.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.office.DocumentSettingsType; import org.oasisopen.names.tc.opendocument.xmlns.office.OfficePackage; import org.oasisopen.names.tc.opendocument.xmlns.office.SettingsType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Document Settings Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.office.impl.DocumentSettingsTypeImpl#getSettings <em>Settings</em>}</li> * <li>{@link org.oasisopen.names.tc.opendocument.xmlns.office.impl.DocumentSettingsTypeImpl#getVersion <em>Version</em>}</li> * </ul> * </p> * * @generated */ public class DocumentSettingsTypeImpl extends EObjectImpl implements DocumentSettingsType { /** * The cached value of the '{@link #getSettings() <em>Settings</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSettings() * @generated * @ordered */ protected SettingsType settings; /** * The default value of the '{@link #getVersion() <em>Version</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVersion() * @generated * @ordered */ protected static final String VERSION_EDEFAULT = null; /** * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVersion() * @generated * @ordered */ protected String version = VERSION_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DocumentSettingsTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return OfficePackage.Literals.DOCUMENT_SETTINGS_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SettingsType getSettings() { return settings; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSettings(SettingsType newSettings, NotificationChain msgs) { SettingsType oldSettings = settings; settings = newSettings; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS, oldSettings, newSettings); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSettings(SettingsType newSettings) { if (newSettings != settings) { NotificationChain msgs = null; if (settings != null) msgs = ((InternalEObject)settings).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS, null, msgs); if (newSettings != null) msgs = ((InternalEObject)newSettings).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS, null, msgs); msgs = basicSetSettings(newSettings, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS, newSettings, newSettings)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getVersion() { return version; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVersion(String newVersion) { String oldVersion = version; version = newVersion; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OfficePackage.DOCUMENT_SETTINGS_TYPE__VERSION, oldVersion, version)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS: return basicSetSettings(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 OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS: return getSettings(); case OfficePackage.DOCUMENT_SETTINGS_TYPE__VERSION: return getVersion(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS: setSettings((SettingsType)newValue); return; case OfficePackage.DOCUMENT_SETTINGS_TYPE__VERSION: setVersion((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS: setSettings((SettingsType)null); return; case OfficePackage.DOCUMENT_SETTINGS_TYPE__VERSION: setVersion(VERSION_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case OfficePackage.DOCUMENT_SETTINGS_TYPE__SETTINGS: return settings != null; case OfficePackage.DOCUMENT_SETTINGS_TYPE__VERSION: return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version); } 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(" (version: "); result.append(version); result.append(')'); return result.toString(); } } //DocumentSettingsTypeImpl