| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.units.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.units.BaseUnit; |
| 10 | import de.uka.ipd.sdq.units.UnitsPackage; |
| 11 | |
| 12 | import org.eclipse.emf.common.notify.Notification; |
| 13 | |
| 14 | import org.eclipse.emf.ecore.EClass; |
| 15 | |
| 16 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 17 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 18 | |
| 19 | /** |
| 20 | * <!-- begin-user-doc --> |
| 21 | * An implementation of the model object '<em><b>Base Unit</b></em>'. |
| 22 | * <!-- end-user-doc --> |
| 23 | * <p> |
| 24 | * The following features are implemented: |
| 25 | * <ul> |
| 26 | * <li>{@link de.uka.ipd.sdq.units.impl.BaseUnitImpl#getName <em>Name</em>}</li> |
| 27 | * </ul> |
| 28 | * </p> |
| 29 | * |
| 30 | * @generated |
| 31 | */ |
| 32 | public class BaseUnitImpl extends EObjectImpl implements BaseUnit { |
| 33 | /** |
| 34 | * <!-- begin-user-doc --> |
| 35 | * <!-- end-user-doc --> |
| 36 | * @generated |
| 37 | */ |
| 38 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 39 | |
| 40 | /** |
| 41 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @see #getName() |
| 45 | * @generated |
| 46 | * @ordered |
| 47 | */ |
| 48 | protected static final String NAME_EDEFAULT = null; |
| 49 | |
| 50 | /** |
| 51 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @see #getName() |
| 55 | * @generated |
| 56 | * @ordered |
| 57 | */ |
| 58 | protected String name = NAME_EDEFAULT; |
| 59 | |
| 60 | /** |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @generated |
| 64 | */ |
| 65 | protected BaseUnitImpl() { |
| 66 | super(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @generated |
| 73 | */ |
| 74 | @Override |
| 75 | protected EClass eStaticClass() { |
| 76 | return UnitsPackage.Literals.BASE_UNIT; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | public String getName() { |
| 85 | return name; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | public void setName(String newName) { |
| 94 | String oldName = name; |
| 95 | name = newName; |
| 96 | if (eNotificationRequired()) |
| 97 | eNotify(new ENotificationImpl(this, Notification.SET, UnitsPackage.BASE_UNIT__NAME, oldName, name)); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | @Override |
| 106 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 107 | switch (featureID) { |
| 108 | case UnitsPackage.BASE_UNIT__NAME: |
| 109 | return getName(); |
| 110 | } |
| 111 | return super.eGet(featureID, resolve, coreType); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * <!-- begin-user-doc --> |
| 116 | * <!-- end-user-doc --> |
| 117 | * @generated |
| 118 | */ |
| 119 | @Override |
| 120 | public void eSet(int featureID, Object newValue) { |
| 121 | switch (featureID) { |
| 122 | case UnitsPackage.BASE_UNIT__NAME: |
| 123 | setName((String)newValue); |
| 124 | return; |
| 125 | } |
| 126 | super.eSet(featureID, newValue); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * <!-- begin-user-doc --> |
| 131 | * <!-- end-user-doc --> |
| 132 | * @generated |
| 133 | */ |
| 134 | @Override |
| 135 | public void eUnset(int featureID) { |
| 136 | switch (featureID) { |
| 137 | case UnitsPackage.BASE_UNIT__NAME: |
| 138 | setName(NAME_EDEFAULT); |
| 139 | return; |
| 140 | } |
| 141 | super.eUnset(featureID); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * <!-- begin-user-doc --> |
| 146 | * <!-- end-user-doc --> |
| 147 | * @generated |
| 148 | */ |
| 149 | @Override |
| 150 | public boolean eIsSet(int featureID) { |
| 151 | switch (featureID) { |
| 152 | case UnitsPackage.BASE_UNIT__NAME: |
| 153 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| 154 | } |
| 155 | return super.eIsSet(featureID); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * <!-- begin-user-doc --> |
| 160 | * <!-- end-user-doc --> |
| 161 | * @generated |
| 162 | */ |
| 163 | @Override |
| 164 | public String toString() { |
| 165 | if (eIsProxy()) return super.toString(); |
| 166 | |
| 167 | StringBuffer result = new StringBuffer(super.toString()); |
| 168 | result.append(" (name: "); |
| 169 | result.append(name); |
| 170 | result.append(')'); |
| 171 | return result.toString(); |
| 172 | } |
| 173 | |
| 174 | } //BaseUnitImpl |