ActionStateImpl.java
Go to the documentation of this file.
00001 
00003 package org.best.of.robotics.smachDSL.impl;
00004 
00005 import java.util.Collection;
00006 
00007 import org.best.of.robotics.smachDSL.ActionClient;
00008 import org.best.of.robotics.smachDSL.ActionState;
00009 import org.best.of.robotics.smachDSL.SmachDSLPackage;
00010 import org.best.of.robotics.smachDSL.Transition;
00011 
00012 import org.eclipse.emf.common.notify.Notification;
00013 import org.eclipse.emf.common.notify.NotificationChain;
00014 
00015 import org.eclipse.emf.common.util.EList;
00016 
00017 import org.eclipse.emf.ecore.EClass;
00018 import org.eclipse.emf.ecore.InternalEObject;
00019 
00020 import org.eclipse.emf.ecore.impl.ENotificationImpl;
00021 import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
00022 
00023 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
00024 import org.eclipse.emf.ecore.util.InternalEList;
00025 
00041 public class ActionStateImpl extends MinimalEObjectImpl.Container implements ActionState
00042 {
00051   protected static final String NAME_EDEFAULT = null;
00052 
00061   protected String name = NAME_EDEFAULT;
00062 
00071   protected ActionClient clientname;
00072 
00081   protected EList<Transition> transitions;
00082 
00088   protected ActionStateImpl()
00089   {
00090     super();
00091   }
00092 
00098   @Override
00099   protected EClass eStaticClass()
00100   {
00101     return SmachDSLPackage.Literals.ACTION_STATE;
00102   }
00103 
00109   public String getName()
00110   {
00111     return name;
00112   }
00113 
00119   public void setName(String newName)
00120   {
00121     String oldName = name;
00122     name = newName;
00123     if (eNotificationRequired())
00124       eNotify(new ENotificationImpl(this, Notification.SET, SmachDSLPackage.ACTION_STATE__NAME, oldName, name));
00125   }
00126 
00132   public ActionClient getClientname()
00133   {
00134     if (clientname != null && clientname.eIsProxy())
00135     {
00136       InternalEObject oldClientname = (InternalEObject)clientname;
00137       clientname = (ActionClient)eResolveProxy(oldClientname);
00138       if (clientname != oldClientname)
00139       {
00140         if (eNotificationRequired())
00141           eNotify(new ENotificationImpl(this, Notification.RESOLVE, SmachDSLPackage.ACTION_STATE__CLIENTNAME, oldClientname, clientname));
00142       }
00143     }
00144     return clientname;
00145   }
00146 
00152   public ActionClient basicGetClientname()
00153   {
00154     return clientname;
00155   }
00156 
00162   public void setClientname(ActionClient newClientname)
00163   {
00164     ActionClient oldClientname = clientname;
00165     clientname = newClientname;
00166     if (eNotificationRequired())
00167       eNotify(new ENotificationImpl(this, Notification.SET, SmachDSLPackage.ACTION_STATE__CLIENTNAME, oldClientname, clientname));
00168   }
00169 
00175   public EList<Transition> getTransitions()
00176   {
00177     if (transitions == null)
00178     {
00179       transitions = new EObjectContainmentEList<Transition>(Transition.class, this, SmachDSLPackage.ACTION_STATE__TRANSITIONS);
00180     }
00181     return transitions;
00182   }
00183 
00189   @Override
00190   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
00191   {
00192     switch (featureID)
00193     {
00194       case SmachDSLPackage.ACTION_STATE__TRANSITIONS:
00195         return ((InternalEList<?>)getTransitions()).basicRemove(otherEnd, msgs);
00196     }
00197     return super.eInverseRemove(otherEnd, featureID, msgs);
00198   }
00199 
00205   @Override
00206   public Object eGet(int featureID, boolean resolve, boolean coreType)
00207   {
00208     switch (featureID)
00209     {
00210       case SmachDSLPackage.ACTION_STATE__NAME:
00211         return getName();
00212       case SmachDSLPackage.ACTION_STATE__CLIENTNAME:
00213         if (resolve) return getClientname();
00214         return basicGetClientname();
00215       case SmachDSLPackage.ACTION_STATE__TRANSITIONS:
00216         return getTransitions();
00217     }
00218     return super.eGet(featureID, resolve, coreType);
00219   }
00220 
00226   @SuppressWarnings("unchecked")
00227   @Override
00228   public void eSet(int featureID, Object newValue)
00229   {
00230     switch (featureID)
00231     {
00232       case SmachDSLPackage.ACTION_STATE__NAME:
00233         setName((String)newValue);
00234         return;
00235       case SmachDSLPackage.ACTION_STATE__CLIENTNAME:
00236         setClientname((ActionClient)newValue);
00237         return;
00238       case SmachDSLPackage.ACTION_STATE__TRANSITIONS:
00239         getTransitions().clear();
00240         getTransitions().addAll((Collection<? extends Transition>)newValue);
00241         return;
00242     }
00243     super.eSet(featureID, newValue);
00244   }
00245 
00251   @Override
00252   public void eUnset(int featureID)
00253   {
00254     switch (featureID)
00255     {
00256       case SmachDSLPackage.ACTION_STATE__NAME:
00257         setName(NAME_EDEFAULT);
00258         return;
00259       case SmachDSLPackage.ACTION_STATE__CLIENTNAME:
00260         setClientname((ActionClient)null);
00261         return;
00262       case SmachDSLPackage.ACTION_STATE__TRANSITIONS:
00263         getTransitions().clear();
00264         return;
00265     }
00266     super.eUnset(featureID);
00267   }
00268 
00274   @Override
00275   public boolean eIsSet(int featureID)
00276   {
00277     switch (featureID)
00278     {
00279       case SmachDSLPackage.ACTION_STATE__NAME:
00280         return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
00281       case SmachDSLPackage.ACTION_STATE__CLIENTNAME:
00282         return clientname != null;
00283       case SmachDSLPackage.ACTION_STATE__TRANSITIONS:
00284         return transitions != null && !transitions.isEmpty();
00285     }
00286     return super.eIsSet(featureID);
00287   }
00288 
00294   @Override
00295   public String toString()
00296   {
00297     if (eIsProxy()) return super.toString();
00298 
00299     StringBuffer result = new StringBuffer(super.toString());
00300     result.append(" (name: ");
00301     result.append(name);
00302     result.append(')');
00303     return result.toString();
00304   }
00305 
00306 } //ActionStateImpl


bride_plugin_source
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:38:34