/*******************************************************************************
* Copyright © 2008, 2013 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*
*******************************************************************************/
package org.eclipse.edt.ide.ui.internal.formatting.profile.impl;
import java.util.Collection;
import org.eclipse.edt.ide.ui.internal.formatting.profile.Profile;
import org.eclipse.edt.ide.ui.internal.formatting.profile.ProfilePackage;
import org.eclipse.edt.ide.ui.internal.formatting.profile.Setting;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Profile</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.ProfileImpl#getSetting <em>Setting</em>}</li>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.ProfileImpl#getBase <em>Base</em>}</li>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.ProfileImpl#isIsBuildIn <em>Is Build In</em>}</li>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.ProfileImpl#getName <em>Name</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ProfileImpl extends EObjectImpl implements Profile {
/**
* The cached value of the '{@link #getSetting() <em>Setting</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSetting()
* @generated
* @ordered
*/
protected EList setting = null;
/**
* The default value of the '{@link #getBase() <em>Base</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase()
* @generated
* @ordered
*/
protected static final String BASE_EDEFAULT = null;
/**
* The cached value of the '{@link #getBase() <em>Base</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase()
* @generated
* @ordered
*/
protected String base = BASE_EDEFAULT;
/**
* The default value of the '{@link #isIsBuildIn() <em>Is Build In</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsBuildIn()
* @generated
* @ordered
*/
protected static final boolean IS_BUILD_IN_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsBuildIn() <em>Is Build In</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsBuildIn()
* @generated
* @ordered
*/
protected boolean isBuildIn = IS_BUILD_IN_EDEFAULT;
/**
* This is true if the Is Build In attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean isBuildInESet = false;
/**
* 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ProfileImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return ProfilePackage.Literals.PROFILE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getSetting() {
if (setting == null) {
setting = new EObjectContainmentEList(Setting.class, this, ProfilePackage.PROFILE__SETTING);
}
return setting;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBase() {
return base;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase(String newBase) {
String oldBase = base;
base = newBase;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.PROFILE__BASE, oldBase, base));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsBuildIn() {
return isBuildIn;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsBuildIn(boolean newIsBuildIn) {
boolean oldIsBuildIn = isBuildIn;
isBuildIn = newIsBuildIn;
boolean oldIsBuildInESet = isBuildInESet;
isBuildInESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.PROFILE__IS_BUILD_IN, oldIsBuildIn, isBuildIn, !oldIsBuildInESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetIsBuildIn() {
boolean oldIsBuildIn = isBuildIn;
boolean oldIsBuildInESet = isBuildInESet;
isBuildIn = IS_BUILD_IN_EDEFAULT;
isBuildInESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ProfilePackage.PROFILE__IS_BUILD_IN, oldIsBuildIn, IS_BUILD_IN_EDEFAULT, oldIsBuildInESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetIsBuildIn() {
return isBuildInESet;
}
/**
* <!-- 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, ProfilePackage.PROFILE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProfilePackage.PROFILE__SETTING:
return ((InternalEList)getSetting()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ProfilePackage.PROFILE__SETTING:
return getSetting();
case ProfilePackage.PROFILE__BASE:
return getBase();
case ProfilePackage.PROFILE__IS_BUILD_IN:
return isIsBuildIn() ? Boolean.TRUE : Boolean.FALSE;
case ProfilePackage.PROFILE__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProfilePackage.PROFILE__SETTING:
getSetting().clear();
getSetting().addAll((Collection)newValue);
return;
case ProfilePackage.PROFILE__BASE:
setBase((String)newValue);
return;
case ProfilePackage.PROFILE__IS_BUILD_IN:
setIsBuildIn(((Boolean)newValue).booleanValue());
return;
case ProfilePackage.PROFILE__NAME:
setName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case ProfilePackage.PROFILE__SETTING:
getSetting().clear();
return;
case ProfilePackage.PROFILE__BASE:
setBase(BASE_EDEFAULT);
return;
case ProfilePackage.PROFILE__IS_BUILD_IN:
unsetIsBuildIn();
return;
case ProfilePackage.PROFILE__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProfilePackage.PROFILE__SETTING:
return setting != null && !setting.isEmpty();
case ProfilePackage.PROFILE__BASE:
return BASE_EDEFAULT == null ? base != null : !BASE_EDEFAULT.equals(base);
case ProfilePackage.PROFILE__IS_BUILD_IN:
return isSetIsBuildIn();
case ProfilePackage.PROFILE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (base: ");
result.append(base);
result.append(", isBuildIn: ");
if (isBuildInESet) result.append(isBuildIn); else result.append("<unset>");
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //ProfileImpl