/** * (c) Urs Zeidler */ package de.urszeidler.eclipse.shr5.gameplay.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import de.urszeidler.eclipse.shr5.gameplay.GameplayPackage; import de.urszeidler.eclipse.shr5.gameplay.SemanticAction; import de.urszeidler.eclipse.shr5.gameplay.SemanticType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Semantic Action</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link de.urszeidler.eclipse.shr5.gameplay.impl.SemanticActionImpl#getType <em>Type</em>}</li> * <li>{@link de.urszeidler.eclipse.shr5.gameplay.impl.SemanticActionImpl#getMessage <em>Message</em>}</li> * </ul> * </p> * * @generated */ public class SemanticActionImpl extends SubjectCommandImpl implements SemanticAction { /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final SemanticType TYPE_EDEFAULT = SemanticType.TALK; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected SemanticType type = TYPE_EDEFAULT; /** * The default value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected static final String MESSAGE_EDEFAULT = null; /** * The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected String message = MESSAGE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SemanticActionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return GameplayPackage.Literals.SEMANTIC_ACTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SemanticType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(SemanticType newType) { SemanticType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GameplayPackage.SEMANTIC_ACTION__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getMessage() { return message; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setMessage(String newMessage) { String oldMessage = message; message = newMessage; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GameplayPackage.SEMANTIC_ACTION__MESSAGE, oldMessage, message)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case GameplayPackage.SEMANTIC_ACTION__TYPE: return getType(); case GameplayPackage.SEMANTIC_ACTION__MESSAGE: return getMessage(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case GameplayPackage.SEMANTIC_ACTION__TYPE: setType((SemanticType)newValue); return; case GameplayPackage.SEMANTIC_ACTION__MESSAGE: setMessage((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case GameplayPackage.SEMANTIC_ACTION__TYPE: setType(TYPE_EDEFAULT); return; case GameplayPackage.SEMANTIC_ACTION__MESSAGE: setMessage(MESSAGE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case GameplayPackage.SEMANTIC_ACTION__TYPE: return type != TYPE_EDEFAULT; case GameplayPackage.SEMANTIC_ACTION__MESSAGE: return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated not */ public void redo() { setExecuting(true); if (isSetCmdCallback()) cmdCallback.beforeExecute(this, GameplayPackage.Literals.SEMANTIC_ACTION__TYPE,GameplayPackage.Literals.SEMANTIC_ACTION__MESSAGE); setExecuted(true); setExecuting(false); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (type: "); result.append(type); result.append(", message: "); result.append(message); result.append(')'); return result.toString(); } } //SemanticActionImpl