/** * Copyright (c) 2011 Cloudsmith Inc. and other contributors, as listed below. * 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: * Cloudsmith * */ package org.cloudsmith.geppetto.pp.pptp.impl; import org.cloudsmith.geppetto.pp.pptp.IDocumented; import org.cloudsmith.geppetto.pp.pptp.PPTPPackage; import org.cloudsmith.geppetto.pp.pptp.TargetElement; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Target Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.cloudsmith.geppetto.pp.pptp.impl.TargetElementImpl#getName <em>Name</em>}</li> * <li>{@link org.cloudsmith.geppetto.pp.pptp.impl.TargetElementImpl#getDocumentation <em>Documentation</em>}</li> * <li>{@link org.cloudsmith.geppetto.pp.pptp.impl.TargetElementImpl#isDeprecated <em>Deprecated</em>}</li> * </ul> * </p> * * @generated */ public abstract class TargetElementImpl extends EObjectImpl implements TargetElement { /** * 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 #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getDocumentation() * @generated * @ordered */ protected static final String DOCUMENTATION_EDEFAULT = null; /** * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getDocumentation() * @generated * @ordered */ protected String documentation = DOCUMENTATION_EDEFAULT; /** * The default value of the '{@link #isDeprecated() <em>Deprecated</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #isDeprecated() * @generated * @ordered */ protected static final boolean DEPRECATED_EDEFAULT = false; /** * The cached value of the '{@link #isDeprecated() <em>Deprecated</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #isDeprecated() * @generated * @ordered */ protected boolean deprecated = DEPRECATED_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ protected TargetElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if(baseClass == IDocumented.class) { switch(derivedFeatureID) { case PPTPPackage.TARGET_ELEMENT__DOCUMENTATION: return PPTPPackage.IDOCUMENTED__DOCUMENTATION; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if(baseClass == IDocumented.class) { switch(baseFeatureID) { case PPTPPackage.IDOCUMENTED__DOCUMENTATION: return PPTPPackage.TARGET_ELEMENT__DOCUMENTATION; default: return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch(featureID) { case PPTPPackage.TARGET_ELEMENT__NAME: return getName(); case PPTPPackage.TARGET_ELEMENT__DOCUMENTATION: return getDocumentation(); case PPTPPackage.TARGET_ELEMENT__DEPRECATED: return isDeprecated(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch(featureID) { case PPTPPackage.TARGET_ELEMENT__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PPTPPackage.TARGET_ELEMENT__DOCUMENTATION: return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); case PPTPPackage.TARGET_ELEMENT__DEPRECATED: return deprecated != DEPRECATED_EDEFAULT; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch(featureID) { case PPTPPackage.TARGET_ELEMENT__NAME: setName((String) newValue); return; case PPTPPackage.TARGET_ELEMENT__DOCUMENTATION: setDocumentation((String) newValue); return; case PPTPPackage.TARGET_ELEMENT__DEPRECATED: setDeprecated((Boolean) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return PPTPPackage.Literals.TARGET_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch(featureID) { case PPTPPackage.TARGET_ELEMENT__NAME: setName(NAME_EDEFAULT); return; case PPTPPackage.TARGET_ELEMENT__DOCUMENTATION: setDocumentation(DOCUMENTATION_EDEFAULT); return; case PPTPPackage.TARGET_ELEMENT__DEPRECATED: setDeprecated(DEPRECATED_EDEFAULT); return; } super.eUnset(featureID); } private String fixUnformattedDoc(String unformatted) { if(unformatted == null || unformatted.length() < 1) return unformatted; if(unformatted.startsWith("<")) return unformatted; // assume it is formatted already unformatted.split("\\n"); return unformatted; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public String getDocumentation() { return documentation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public boolean isDeprecated() { return deprecated; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void setDeprecated(boolean newDeprecated) { boolean oldDeprecated = deprecated; deprecated = newDeprecated; if(eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.SET, PPTPPackage.TARGET_ELEMENT__DEPRECATED, oldDeprecated, deprecated)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void setDocumentation(String newDocumentation) { String oldDocumentation = documentation; documentation = fixUnformattedDoc(newDocumentation); if(eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.SET, PPTPPackage.TARGET_ELEMENT__DOCUMENTATION, oldDocumentation, documentation)); } /** * <!-- 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, PPTPPackage.TARGET_ELEMENT__NAME, oldName, name)); } /** * <!-- 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(", documentation: "); result.append(documentation); result.append(", deprecated: "); result.append(deprecated); result.append(')'); return result.toString(); } } // TargetElementImpl