StateMachineImpl.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.ServiceClient;
00010 import org.best.of.robotics.smachDSL.SmachDSLPackage;
00011 import org.best.of.robotics.smachDSL.StateMachine;
00012 
00013 import org.eclipse.emf.common.notify.Notification;
00014 import org.eclipse.emf.common.notify.NotificationChain;
00015 
00016 import org.eclipse.emf.common.util.EList;
00017 
00018 import org.eclipse.emf.ecore.EClass;
00019 import org.eclipse.emf.ecore.InternalEObject;
00020 
00021 import org.eclipse.emf.ecore.impl.ENotificationImpl;
00022 import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
00023 
00024 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
00025 import org.eclipse.emf.ecore.util.InternalEList;
00026 
00043 public class StateMachineImpl extends MinimalEObjectImpl.Container implements StateMachine
00044 {
00053   protected static final String NAME_EDEFAULT = null;
00054 
00063   protected String name = NAME_EDEFAULT;
00064 
00073   protected EList<ActionClient> actionclients;
00074 
00083   protected EList<ServiceClient> serviceclients;
00084 
00093   protected EList<ActionState> actionsstates;
00094 
00100   protected StateMachineImpl()
00101   {
00102     super();
00103   }
00104 
00110   @Override
00111   protected EClass eStaticClass()
00112   {
00113     return SmachDSLPackage.Literals.STATE_MACHINE;
00114   }
00115 
00121   public String getName()
00122   {
00123     return name;
00124   }
00125 
00131   public void setName(String newName)
00132   {
00133     String oldName = name;
00134     name = newName;
00135     if (eNotificationRequired())
00136       eNotify(new ENotificationImpl(this, Notification.SET, SmachDSLPackage.STATE_MACHINE__NAME, oldName, name));
00137   }
00138 
00144   public EList<ActionClient> getActionclients()
00145   {
00146     if (actionclients == null)
00147     {
00148       actionclients = new EObjectContainmentEList<ActionClient>(ActionClient.class, this, SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS);
00149     }
00150     return actionclients;
00151   }
00152 
00158   public EList<ServiceClient> getServiceclients()
00159   {
00160     if (serviceclients == null)
00161     {
00162       serviceclients = new EObjectContainmentEList<ServiceClient>(ServiceClient.class, this, SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS);
00163     }
00164     return serviceclients;
00165   }
00166 
00172   public EList<ActionState> getActionsstates()
00173   {
00174     if (actionsstates == null)
00175     {
00176       actionsstates = new EObjectContainmentEList<ActionState>(ActionState.class, this, SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES);
00177     }
00178     return actionsstates;
00179   }
00180 
00186   @Override
00187   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
00188   {
00189     switch (featureID)
00190     {
00191       case SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS:
00192         return ((InternalEList<?>)getActionclients()).basicRemove(otherEnd, msgs);
00193       case SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS:
00194         return ((InternalEList<?>)getServiceclients()).basicRemove(otherEnd, msgs);
00195       case SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES:
00196         return ((InternalEList<?>)getActionsstates()).basicRemove(otherEnd, msgs);
00197     }
00198     return super.eInverseRemove(otherEnd, featureID, msgs);
00199   }
00200 
00206   @Override
00207   public Object eGet(int featureID, boolean resolve, boolean coreType)
00208   {
00209     switch (featureID)
00210     {
00211       case SmachDSLPackage.STATE_MACHINE__NAME:
00212         return getName();
00213       case SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS:
00214         return getActionclients();
00215       case SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS:
00216         return getServiceclients();
00217       case SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES:
00218         return getActionsstates();
00219     }
00220     return super.eGet(featureID, resolve, coreType);
00221   }
00222 
00228   @SuppressWarnings("unchecked")
00229   @Override
00230   public void eSet(int featureID, Object newValue)
00231   {
00232     switch (featureID)
00233     {
00234       case SmachDSLPackage.STATE_MACHINE__NAME:
00235         setName((String)newValue);
00236         return;
00237       case SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS:
00238         getActionclients().clear();
00239         getActionclients().addAll((Collection<? extends ActionClient>)newValue);
00240         return;
00241       case SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS:
00242         getServiceclients().clear();
00243         getServiceclients().addAll((Collection<? extends ServiceClient>)newValue);
00244         return;
00245       case SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES:
00246         getActionsstates().clear();
00247         getActionsstates().addAll((Collection<? extends ActionState>)newValue);
00248         return;
00249     }
00250     super.eSet(featureID, newValue);
00251   }
00252 
00258   @Override
00259   public void eUnset(int featureID)
00260   {
00261     switch (featureID)
00262     {
00263       case SmachDSLPackage.STATE_MACHINE__NAME:
00264         setName(NAME_EDEFAULT);
00265         return;
00266       case SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS:
00267         getActionclients().clear();
00268         return;
00269       case SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS:
00270         getServiceclients().clear();
00271         return;
00272       case SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES:
00273         getActionsstates().clear();
00274         return;
00275     }
00276     super.eUnset(featureID);
00277   }
00278 
00284   @Override
00285   public boolean eIsSet(int featureID)
00286   {
00287     switch (featureID)
00288     {
00289       case SmachDSLPackage.STATE_MACHINE__NAME:
00290         return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
00291       case SmachDSLPackage.STATE_MACHINE__ACTIONCLIENTS:
00292         return actionclients != null && !actionclients.isEmpty();
00293       case SmachDSLPackage.STATE_MACHINE__SERVICECLIENTS:
00294         return serviceclients != null && !serviceclients.isEmpty();
00295       case SmachDSLPackage.STATE_MACHINE__ACTIONSSTATES:
00296         return actionsstates != null && !actionsstates.isEmpty();
00297     }
00298     return super.eIsSet(featureID);
00299   }
00300 
00306   @Override
00307   public String toString()
00308   {
00309     if (eIsProxy()) return super.toString();
00310 
00311     StringBuffer result = new StringBuffer(super.toString());
00312     result.append(" (name: ");
00313     result.append(name);
00314     result.append(')');
00315     return result.toString();
00316   }
00317 
00318 } //StateMachineImpl


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