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.DatatypesPackage;
00012 import org.best_of_robotics.model.datatypes.RosIDLReference;
00013
00014 import org.eclipse.emf.common.notify.Notification;
00015
00016 import org.eclipse.emf.ecore.EClass;
00017
00018 import org.eclipse.emf.ecore.impl.ENotificationImpl;
00019
00034 public class RosIDLReferenceImpl extends IDLReferenceImpl implements RosIDLReference {
00043 protected static final String NAMESPACE_EDEFAULT = null;
00044
00053 protected String namespace = NAMESPACE_EDEFAULT;
00054
00063 protected static final String ROS_PACKAGE_EDEFAULT = null;
00064
00073 protected String rosPackage = ROS_PACKAGE_EDEFAULT;
00074
00080 protected RosIDLReferenceImpl() {
00081 super();
00082 }
00083
00089 @Override
00090 protected EClass eStaticClass() {
00091 return DatatypesPackage.Literals.ROS_IDL_REFERENCE;
00092 }
00093
00099 public String getNamespace() {
00100 return namespace;
00101 }
00102
00108 public void setNamespace(String newNamespace) {
00109 String oldNamespace = namespace;
00110 namespace = newNamespace;
00111 if (eNotificationRequired())
00112 eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE, oldNamespace, namespace));
00113 }
00114
00120 public String getRosPackage() {
00121 return rosPackage;
00122 }
00123
00129 public void setRosPackage(String newRosPackage) {
00130 String oldRosPackage = rosPackage;
00131 rosPackage = newRosPackage;
00132 if (eNotificationRequired())
00133 eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE, oldRosPackage, rosPackage));
00134 }
00135
00141 @Override
00142 public Object eGet(int featureID, boolean resolve, boolean coreType) {
00143 switch (featureID) {
00144 case DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE:
00145 return getNamespace();
00146 case DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE:
00147 return getRosPackage();
00148 }
00149 return super.eGet(featureID, resolve, coreType);
00150 }
00151
00157 @Override
00158 public void eSet(int featureID, Object newValue) {
00159 switch (featureID) {
00160 case DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE:
00161 setNamespace((String)newValue);
00162 return;
00163 case DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE:
00164 setRosPackage((String)newValue);
00165 return;
00166 }
00167 super.eSet(featureID, newValue);
00168 }
00169
00175 @Override
00176 public void eUnset(int featureID) {
00177 switch (featureID) {
00178 case DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE:
00179 setNamespace(NAMESPACE_EDEFAULT);
00180 return;
00181 case DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE:
00182 setRosPackage(ROS_PACKAGE_EDEFAULT);
00183 return;
00184 }
00185 super.eUnset(featureID);
00186 }
00187
00193 @Override
00194 public boolean eIsSet(int featureID) {
00195 switch (featureID) {
00196 case DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE:
00197 return NAMESPACE_EDEFAULT == null ? namespace != null : !NAMESPACE_EDEFAULT.equals(namespace);
00198 case DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE:
00199 return ROS_PACKAGE_EDEFAULT == null ? rosPackage != null : !ROS_PACKAGE_EDEFAULT.equals(rosPackage);
00200 }
00201 return super.eIsSet(featureID);
00202 }
00203
00209 @Override
00210 public String toString() {
00211 if (eIsProxy()) return super.toString();
00212
00213 StringBuffer result = new StringBuffer(super.toString());
00214 result.append(" (namespace: ");
00215 result.append(namespace);
00216 result.append(", rosPackage: ");
00217 result.append(rosPackage);
00218 result.append(')');
00219 return result.toString();
00220 }
00221
00227 public String getLabel(){
00228 String label = name;
00229 if( namespace !=null && namespace.length()>0 )
00230 label = namespace + "::" + label;
00231 return label;
00232 }
00233
00234 }