Go to the documentation of this file.00001
00003 package org.best.of.robotics.smachDSL.impl;
00004
00005 import org.best.of.robotics.smachDSL.ActionState;
00006 import org.best.of.robotics.smachDSL.SmachDSLPackage;
00007 import org.best.of.robotics.smachDSL.Transition;
00008
00009 import org.eclipse.emf.common.notify.Notification;
00010
00011 import org.eclipse.emf.ecore.EClass;
00012 import org.eclipse.emf.ecore.InternalEObject;
00013
00014 import org.eclipse.emf.ecore.impl.ENotificationImpl;
00015 import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
00016
00031 public class TransitionImpl extends MinimalEObjectImpl.Container implements Transition
00032 {
00041 protected static final String OUTCOME_EDEFAULT = null;
00042
00051 protected String outcome = OUTCOME_EDEFAULT;
00052
00061 protected ActionState state;
00062
00068 protected TransitionImpl()
00069 {
00070 super();
00071 }
00072
00078 @Override
00079 protected EClass eStaticClass()
00080 {
00081 return SmachDSLPackage.Literals.TRANSITION;
00082 }
00083
00089 public String getOutcome()
00090 {
00091 return outcome;
00092 }
00093
00099 public void setOutcome(String newOutcome)
00100 {
00101 String oldOutcome = outcome;
00102 outcome = newOutcome;
00103 if (eNotificationRequired())
00104 eNotify(new ENotificationImpl(this, Notification.SET, SmachDSLPackage.TRANSITION__OUTCOME, oldOutcome, outcome));
00105 }
00106
00112 public ActionState getState()
00113 {
00114 if (state != null && state.eIsProxy())
00115 {
00116 InternalEObject oldState = (InternalEObject)state;
00117 state = (ActionState)eResolveProxy(oldState);
00118 if (state != oldState)
00119 {
00120 if (eNotificationRequired())
00121 eNotify(new ENotificationImpl(this, Notification.RESOLVE, SmachDSLPackage.TRANSITION__STATE, oldState, state));
00122 }
00123 }
00124 return state;
00125 }
00126
00132 public ActionState basicGetState()
00133 {
00134 return state;
00135 }
00136
00142 public void setState(ActionState newState)
00143 {
00144 ActionState oldState = state;
00145 state = newState;
00146 if (eNotificationRequired())
00147 eNotify(new ENotificationImpl(this, Notification.SET, SmachDSLPackage.TRANSITION__STATE, oldState, state));
00148 }
00149
00155 @Override
00156 public Object eGet(int featureID, boolean resolve, boolean coreType)
00157 {
00158 switch (featureID)
00159 {
00160 case SmachDSLPackage.TRANSITION__OUTCOME:
00161 return getOutcome();
00162 case SmachDSLPackage.TRANSITION__STATE:
00163 if (resolve) return getState();
00164 return basicGetState();
00165 }
00166 return super.eGet(featureID, resolve, coreType);
00167 }
00168
00174 @Override
00175 public void eSet(int featureID, Object newValue)
00176 {
00177 switch (featureID)
00178 {
00179 case SmachDSLPackage.TRANSITION__OUTCOME:
00180 setOutcome((String)newValue);
00181 return;
00182 case SmachDSLPackage.TRANSITION__STATE:
00183 setState((ActionState)newValue);
00184 return;
00185 }
00186 super.eSet(featureID, newValue);
00187 }
00188
00194 @Override
00195 public void eUnset(int featureID)
00196 {
00197 switch (featureID)
00198 {
00199 case SmachDSLPackage.TRANSITION__OUTCOME:
00200 setOutcome(OUTCOME_EDEFAULT);
00201 return;
00202 case SmachDSLPackage.TRANSITION__STATE:
00203 setState((ActionState)null);
00204 return;
00205 }
00206 super.eUnset(featureID);
00207 }
00208
00214 @Override
00215 public boolean eIsSet(int featureID)
00216 {
00217 switch (featureID)
00218 {
00219 case SmachDSLPackage.TRANSITION__OUTCOME:
00220 return OUTCOME_EDEFAULT == null ? outcome != null : !OUTCOME_EDEFAULT.equals(outcome);
00221 case SmachDSLPackage.TRANSITION__STATE:
00222 return state != null;
00223 }
00224 return super.eIsSet(featureID);
00225 }
00226
00232 @Override
00233 public String toString()
00234 {
00235 if (eIsProxy()) return super.toString();
00236
00237 StringBuffer result = new StringBuffer(super.toString());
00238 result.append(" (outcome: ");
00239 result.append(outcome);
00240 result.append(')');
00241 return result.toString();
00242 }
00243
00244 }