Go to the documentation of this file.00001
00007 package org.best_of_robotics.model.datatypes.impl;
00008
00009 import java.lang.String;
00010 import java.util.Collection;
00011
00012 import org.best_of_robotics.model.datatypes.DataType;
00013 import org.best_of_robotics.model.datatypes.Bool;
00014 import org.best_of_robotics.model.datatypes.Char;
00015 import org.best_of_robotics.model.datatypes.ComplexType;
00016 import org.best_of_robotics.model.datatypes.DatatypesPackage;
00017 import org.best_of_robotics.model.datatypes.Int;
00018 import org.best_of_robotics.model.datatypes.TypesLibrary;
00019 import org.best_of_robotics.model.datatypes.UnsignedChar;
00020 import org.best_of_robotics.model.datatypes.UnsignedInt;
00021 import org.best_of_robotics.model.datatypes.UnsignedLong;
00022 import org.best_of_robotics.model.datatypes.UnsignedShort;
00023 import org.eclipse.emf.common.notify.Notification;
00024 import org.eclipse.emf.common.notify.NotificationChain;
00025 import org.eclipse.emf.common.util.EList;
00026 import org.eclipse.emf.ecore.EClass;
00027 import org.eclipse.emf.ecore.InternalEObject;
00028 import org.eclipse.emf.ecore.impl.ENotificationImpl;
00029 import org.eclipse.emf.ecore.impl.EObjectImpl;
00030 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
00031 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
00032 import org.eclipse.emf.ecore.util.EObjectResolvingEList;
00033 import org.eclipse.emf.ecore.util.InternalEList;
00034
00050 public class TypesLibraryImpl extends EObjectImpl implements TypesLibrary {
00059 protected EList<DataType> types;
00060
00069 protected static final String NAME_EDEFAULT = null;
00070
00079 protected String name = NAME_EDEFAULT;
00080
00089 protected EList<TypesLibrary> includes;
00090
00096 protected TypesLibraryImpl() {
00097 super();
00098 }
00099
00105 @Override
00106 protected EClass eStaticClass() {
00107 return DatatypesPackage.Literals.TYPES_LIBRARY;
00108 }
00109
00115 public EList<DataType> getTypes() {
00116 if (types == null) {
00117 types = new EObjectContainmentWithInverseEList<DataType>(DataType.class, this, DatatypesPackage.TYPES_LIBRARY__TYPES, DatatypesPackage.DATA_TYPE__TYPES_LIBRARY);
00118 }
00119 return types;
00120 }
00121
00127 public String getName() {
00128 return name;
00129 }
00130
00136 public void setName(String newName) {
00137 String oldName = name;
00138 name = newName;
00139 if (eNotificationRequired())
00140 eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.TYPES_LIBRARY__NAME, oldName, name));
00141 }
00142
00148 public EList<TypesLibrary> getIncludes() {
00149 if (includes == null) {
00150 includes = new EObjectResolvingEList<TypesLibrary>(TypesLibrary.class, this, DatatypesPackage.TYPES_LIBRARY__INCLUDES);
00151 }
00152 return includes;
00153 }
00154
00160 @SuppressWarnings("unchecked")
00161 @Override
00162 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
00163 switch (featureID) {
00164 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00165 return ((InternalEList<InternalEObject>)(InternalEList<?>)getTypes()).basicAdd(otherEnd, msgs);
00166 }
00167 return super.eInverseAdd(otherEnd, featureID, msgs);
00168 }
00169
00175 @Override
00176 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
00177 switch (featureID) {
00178 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00179 return ((InternalEList<?>)getTypes()).basicRemove(otherEnd, msgs);
00180 }
00181 return super.eInverseRemove(otherEnd, featureID, msgs);
00182 }
00183
00189 @Override
00190 public Object eGet(int featureID, boolean resolve, boolean coreType) {
00191 switch (featureID) {
00192 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00193 return getTypes();
00194 case DatatypesPackage.TYPES_LIBRARY__NAME:
00195 return getName();
00196 case DatatypesPackage.TYPES_LIBRARY__INCLUDES:
00197 return getIncludes();
00198 }
00199 return super.eGet(featureID, resolve, coreType);
00200 }
00201
00207 @SuppressWarnings("unchecked")
00208 @Override
00209 public void eSet(int featureID, Object newValue) {
00210 switch (featureID) {
00211 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00212 getTypes().clear();
00213 getTypes().addAll((Collection<? extends DataType>)newValue);
00214 return;
00215 case DatatypesPackage.TYPES_LIBRARY__NAME:
00216 setName((String)newValue);
00217 return;
00218 case DatatypesPackage.TYPES_LIBRARY__INCLUDES:
00219 getIncludes().clear();
00220 getIncludes().addAll((Collection<? extends TypesLibrary>)newValue);
00221 return;
00222 }
00223 super.eSet(featureID, newValue);
00224 }
00225
00231 @Override
00232 public void eUnset(int featureID) {
00233 switch (featureID) {
00234 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00235 getTypes().clear();
00236 return;
00237 case DatatypesPackage.TYPES_LIBRARY__NAME:
00238 setName(NAME_EDEFAULT);
00239 return;
00240 case DatatypesPackage.TYPES_LIBRARY__INCLUDES:
00241 getIncludes().clear();
00242 return;
00243 }
00244 super.eUnset(featureID);
00245 }
00246
00252 @Override
00253 public boolean eIsSet(int featureID) {
00254 switch (featureID) {
00255 case DatatypesPackage.TYPES_LIBRARY__TYPES:
00256 return types != null && !types.isEmpty();
00257 case DatatypesPackage.TYPES_LIBRARY__NAME:
00258 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
00259 case DatatypesPackage.TYPES_LIBRARY__INCLUDES:
00260 return includes != null && !includes.isEmpty();
00261 }
00262 return super.eIsSet(featureID);
00263 }
00264
00270 @Override
00271 public String toString() {
00272 if (eIsProxy()) return super.toString();
00273
00274 StringBuffer result = new StringBuffer(super.toString());
00275 result.append(" (name: ");
00276 result.append(name);
00277 result.append(')');
00278 return result.toString();
00279 }
00280
00281 }