FieldImpl.java
Go to the documentation of this file.
00001 
00007 package org.best_of_robotics.model.datatypes.impl;
00008 
00009 import java.lang.String;
00010 
00011 import org.best_of_robotics.model.datatypes.DataType;
00012 import org.best_of_robotics.model.datatypes.DatatypesPackage;
00013 import org.best_of_robotics.model.datatypes.Field;
00014 
00015 import org.eclipse.emf.common.notify.Notification;
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.EObjectImpl;
00022 
00039 public class FieldImpl extends EObjectImpl implements Field {
00048         protected static final String NAME_EDEFAULT = null;
00049 
00058         protected String name = NAME_EDEFAULT;
00059 
00068         protected DataType type;
00069 
00078         protected static final String DESCRIPTION_EDEFAULT = null;
00079 
00088         protected String description = DESCRIPTION_EDEFAULT;
00089 
00098         protected static final String MEASURE_UNIT_EDEFAULT = null;
00099 
00108         protected String measureUnit = MEASURE_UNIT_EDEFAULT;
00109 
00115         protected FieldImpl() {
00116                 super();
00117         }
00118 
00124         @Override
00125         protected EClass eStaticClass() {
00126                 return DatatypesPackage.Literals.FIELD;
00127         }
00128 
00134         public String getName() {
00135                 return name;
00136         }
00137 
00143         public void setName(String newName) {
00144                 String oldName = name;
00145                 name = newName;
00146                 if (eNotificationRequired())
00147                         eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.FIELD__NAME, oldName, name));
00148         }
00149 
00155         public DataType getType() {
00156                 if (type != null && type.eIsProxy()) {
00157                         InternalEObject oldType = (InternalEObject)type;
00158                         type = (DataType)eResolveProxy(oldType);
00159                         if (type != oldType) {
00160                                 if (eNotificationRequired())
00161                                         eNotify(new ENotificationImpl(this, Notification.RESOLVE, DatatypesPackage.FIELD__TYPE, oldType, type));
00162                         }
00163                 }
00164                 return type;
00165         }
00166 
00172         public DataType basicGetType() {
00173                 return type;
00174         }
00175 
00181         public void setType(DataType newType) {
00182                 DataType oldType = type;
00183                 type = newType;
00184                 if (eNotificationRequired())
00185                         eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.FIELD__TYPE, oldType, type));
00186         }
00187 
00193         public String getDescription() {
00194                 return description;
00195         }
00196 
00202         public void setDescription(String newDescription) {
00203                 String oldDescription = description;
00204                 description = newDescription;
00205                 if (eNotificationRequired())
00206                         eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.FIELD__DESCRIPTION, oldDescription, description));
00207         }
00208 
00214         public String getMeasureUnit() {
00215                 return measureUnit;
00216         }
00217 
00223         public void setMeasureUnit(String newMeasureUnit) {
00224                 String oldMeasureUnit = measureUnit;
00225                 measureUnit = newMeasureUnit;
00226                 if (eNotificationRequired())
00227                         eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.FIELD__MEASURE_UNIT, oldMeasureUnit, measureUnit));
00228         }
00229 
00235         @Override
00236         public Object eGet(int featureID, boolean resolve, boolean coreType) {
00237                 switch (featureID) {
00238                         case DatatypesPackage.FIELD__NAME:
00239                                 return getName();
00240                         case DatatypesPackage.FIELD__TYPE:
00241                                 if (resolve) return getType();
00242                                 return basicGetType();
00243                         case DatatypesPackage.FIELD__DESCRIPTION:
00244                                 return getDescription();
00245                         case DatatypesPackage.FIELD__MEASURE_UNIT:
00246                                 return getMeasureUnit();
00247                 }
00248                 return super.eGet(featureID, resolve, coreType);
00249         }
00250 
00256         @Override
00257         public void eSet(int featureID, Object newValue) {
00258                 switch (featureID) {
00259                         case DatatypesPackage.FIELD__NAME:
00260                                 setName((String)newValue);
00261                                 return;
00262                         case DatatypesPackage.FIELD__TYPE:
00263                                 setType((DataType)newValue);
00264                                 return;
00265                         case DatatypesPackage.FIELD__DESCRIPTION:
00266                                 setDescription((String)newValue);
00267                                 return;
00268                         case DatatypesPackage.FIELD__MEASURE_UNIT:
00269                                 setMeasureUnit((String)newValue);
00270                                 return;
00271                 }
00272                 super.eSet(featureID, newValue);
00273         }
00274 
00280         @Override
00281         public void eUnset(int featureID) {
00282                 switch (featureID) {
00283                         case DatatypesPackage.FIELD__NAME:
00284                                 setName(NAME_EDEFAULT);
00285                                 return;
00286                         case DatatypesPackage.FIELD__TYPE:
00287                                 setType((DataType)null);
00288                                 return;
00289                         case DatatypesPackage.FIELD__DESCRIPTION:
00290                                 setDescription(DESCRIPTION_EDEFAULT);
00291                                 return;
00292                         case DatatypesPackage.FIELD__MEASURE_UNIT:
00293                                 setMeasureUnit(MEASURE_UNIT_EDEFAULT);
00294                                 return;
00295                 }
00296                 super.eUnset(featureID);
00297         }
00298 
00304         @Override
00305         public boolean eIsSet(int featureID) {
00306                 switch (featureID) {
00307                         case DatatypesPackage.FIELD__NAME:
00308                                 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
00309                         case DatatypesPackage.FIELD__TYPE:
00310                                 return type != null;
00311                         case DatatypesPackage.FIELD__DESCRIPTION:
00312                                 return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
00313                         case DatatypesPackage.FIELD__MEASURE_UNIT:
00314                                 return MEASURE_UNIT_EDEFAULT == null ? measureUnit != null : !MEASURE_UNIT_EDEFAULT.equals(measureUnit);
00315                 }
00316                 return super.eIsSet(featureID);
00317         }
00318 
00324         @Override
00325         public String toString() {
00326                 if (eIsProxy()) return super.toString();
00327 
00328                 StringBuffer result = new StringBuffer(super.toString());
00329                 result.append(" (name: ");
00330                 result.append(name);
00331                 result.append(", description: ");
00332                 result.append(description);
00333                 result.append(", measureUnit: ");
00334                 result.append(measureUnit);
00335                 result.append(')');
00336                 return result.toString();
00337         }
00338 
00339 } //FieldImpl
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


bride_plugin_source
Author(s): Alexander Bubeck
autogenerated on Wed Aug 14 2013 10:06:09