| 1 | /**
|
|---|
| 2 | */
|
|---|
| 3 | package de.ugoe.cs.cpdp.decentApp.models.decent.impl;
|
|---|
| 4 |
|
|---|
| 5 | import java.util.Collection;
|
|---|
| 6 |
|
|---|
| 7 | import org.eclipse.emf.common.notify.Notification;
|
|---|
| 8 | import org.eclipse.emf.common.util.EList;
|
|---|
| 9 | import org.eclipse.emf.ecore.EClass;
|
|---|
| 10 | import org.eclipse.emf.ecore.EDataType;
|
|---|
| 11 | import org.eclipse.emf.ecore.InternalEObject;
|
|---|
| 12 | import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
|---|
| 13 | import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
|---|
| 14 |
|
|---|
| 15 | import de.ugoe.cs.cpdp.decentApp.models.decent.ArtifactType;
|
|---|
| 16 | import de.ugoe.cs.cpdp.decentApp.models.decent.Attribute;
|
|---|
| 17 | import de.ugoe.cs.cpdp.decentApp.models.decent.DECENTPackage;
|
|---|
| 18 | import de.ugoe.cs.cpdp.decentApp.models.decent.Dimension;
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * <!-- begin-user-doc -->
|
|---|
| 22 | * An implementation of the model object '<em><b>Attribute</b></em>'.
|
|---|
| 23 | * <!-- end-user-doc -->
|
|---|
| 24 | * <p>
|
|---|
| 25 | * The following features are implemented:
|
|---|
| 26 | * <ul>
|
|---|
| 27 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.AttributeImpl#getArtifactTypes <em>Artifact Types</em>}</li>
|
|---|
| 28 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.AttributeImpl#getType <em>Type</em>}</li>
|
|---|
| 29 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.AttributeImpl#getDimension <em>Dimension</em>}</li>
|
|---|
| 30 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.AttributeImpl#getDescription <em>Description</em>}</li>
|
|---|
| 31 | * </ul>
|
|---|
| 32 | * </p>
|
|---|
| 33 | *
|
|---|
| 34 | * @generated
|
|---|
| 35 | */
|
|---|
| 36 | public class AttributeImpl extends ElementImpl implements Attribute {
|
|---|
| 37 | /**
|
|---|
| 38 | * The cached value of the '{@link #getArtifactTypes() <em>Artifact Types</em>}' reference list.
|
|---|
| 39 | * <!-- begin-user-doc -->
|
|---|
| 40 | * <!-- end-user-doc -->
|
|---|
| 41 | * @see #getArtifactTypes()
|
|---|
| 42 | * @generated
|
|---|
| 43 | * @ordered
|
|---|
| 44 | */
|
|---|
| 45 | protected EList<ArtifactType> artifactTypes;
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| 48 | * The cached value of the '{@link #getType() <em>Type</em>}' reference.
|
|---|
| 49 | * <!-- begin-user-doc -->
|
|---|
| 50 | * <!-- end-user-doc -->
|
|---|
| 51 | * @see #getType()
|
|---|
| 52 | * @generated
|
|---|
| 53 | * @ordered
|
|---|
| 54 | */
|
|---|
| 55 | protected EDataType type;
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | * The cached value of the '{@link #getDimension() <em>Dimension</em>}' reference list.
|
|---|
| 59 | * <!-- begin-user-doc -->
|
|---|
| 60 | * <!-- end-user-doc -->
|
|---|
| 61 | * @see #getDimension()
|
|---|
| 62 | * @generated
|
|---|
| 63 | * @ordered
|
|---|
| 64 | */
|
|---|
| 65 | protected EList<Dimension> dimension;
|
|---|
| 66 |
|
|---|
| 67 | /**
|
|---|
| 68 | * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
|
|---|
| 69 | * <!-- begin-user-doc -->
|
|---|
| 70 | * <!-- end-user-doc -->
|
|---|
| 71 | * @see #getDescription()
|
|---|
| 72 | * @generated
|
|---|
| 73 | * @ordered
|
|---|
| 74 | */
|
|---|
| 75 | protected static final String DESCRIPTION_EDEFAULT = null;
|
|---|
| 76 |
|
|---|
| 77 | /**
|
|---|
| 78 | * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
|
|---|
| 79 | * <!-- begin-user-doc -->
|
|---|
| 80 | * <!-- end-user-doc -->
|
|---|
| 81 | * @see #getDescription()
|
|---|
| 82 | * @generated
|
|---|
| 83 | * @ordered
|
|---|
| 84 | */
|
|---|
| 85 | protected String description = DESCRIPTION_EDEFAULT;
|
|---|
| 86 |
|
|---|
| 87 | /**
|
|---|
| 88 | * <!-- begin-user-doc -->
|
|---|
| 89 | * <!-- end-user-doc -->
|
|---|
| 90 | * @generated
|
|---|
| 91 | */
|
|---|
| 92 | protected AttributeImpl() {
|
|---|
| 93 | super();
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | * <!-- begin-user-doc -->
|
|---|
| 98 | * <!-- end-user-doc -->
|
|---|
| 99 | * @generated
|
|---|
| 100 | */
|
|---|
| 101 | @Override
|
|---|
| 102 | protected EClass eStaticClass() {
|
|---|
| 103 | return DECENTPackage.Literals.ATTRIBUTE;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | /**
|
|---|
| 107 | * <!-- begin-user-doc -->
|
|---|
| 108 | * <!-- end-user-doc -->
|
|---|
| 109 | * @generated
|
|---|
| 110 | */
|
|---|
| 111 | public EList<ArtifactType> getArtifactTypes() {
|
|---|
| 112 | if (artifactTypes == null) {
|
|---|
| 113 | artifactTypes = new EObjectResolvingEList<ArtifactType>(ArtifactType.class, this, DECENTPackage.ATTRIBUTE__ARTIFACT_TYPES);
|
|---|
| 114 | }
|
|---|
| 115 | return artifactTypes;
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | /**
|
|---|
| 119 | * <!-- begin-user-doc -->
|
|---|
| 120 | * <!-- end-user-doc -->
|
|---|
| 121 | * @generated
|
|---|
| 122 | */
|
|---|
| 123 | public EDataType getType() {
|
|---|
| 124 | if (type != null && type.eIsProxy()) {
|
|---|
| 125 | InternalEObject oldType = (InternalEObject)type;
|
|---|
| 126 | type = (EDataType)eResolveProxy(oldType);
|
|---|
| 127 | if (type != oldType) {
|
|---|
| 128 | if (eNotificationRequired())
|
|---|
| 129 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, DECENTPackage.ATTRIBUTE__TYPE, oldType, type));
|
|---|
| 130 | }
|
|---|
| 131 | }
|
|---|
| 132 | return type;
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| 135 | /**
|
|---|
| 136 | * <!-- begin-user-doc -->
|
|---|
| 137 | * <!-- end-user-doc -->
|
|---|
| 138 | * @generated
|
|---|
| 139 | */
|
|---|
| 140 | public EDataType basicGetType() {
|
|---|
| 141 | return type;
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | /**
|
|---|
| 145 | * <!-- begin-user-doc -->
|
|---|
| 146 | * <!-- end-user-doc -->
|
|---|
| 147 | * @generated
|
|---|
| 148 | */
|
|---|
| 149 | public void setType(EDataType newType) {
|
|---|
| 150 | EDataType oldType = type;
|
|---|
| 151 | type = newType;
|
|---|
| 152 | if (eNotificationRequired())
|
|---|
| 153 | eNotify(new ENotificationImpl(this, Notification.SET, DECENTPackage.ATTRIBUTE__TYPE, oldType, type));
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | /**
|
|---|
| 157 | * <!-- begin-user-doc -->
|
|---|
| 158 | * <!-- end-user-doc -->
|
|---|
| 159 | * @generated
|
|---|
| 160 | */
|
|---|
| 161 | public EList<Dimension> getDimension() {
|
|---|
| 162 | if (dimension == null) {
|
|---|
| 163 | dimension = new EObjectResolvingEList<Dimension>(Dimension.class, this, DECENTPackage.ATTRIBUTE__DIMENSION);
|
|---|
| 164 | }
|
|---|
| 165 | return dimension;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | /**
|
|---|
| 169 | * <!-- begin-user-doc -->
|
|---|
| 170 | * <!-- end-user-doc -->
|
|---|
| 171 | * @generated
|
|---|
| 172 | */
|
|---|
| 173 | public String getDescription() {
|
|---|
| 174 | return description;
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 | /**
|
|---|
| 178 | * <!-- begin-user-doc -->
|
|---|
| 179 | * <!-- end-user-doc -->
|
|---|
| 180 | * @generated
|
|---|
| 181 | */
|
|---|
| 182 | public void setDescription(String newDescription) {
|
|---|
| 183 | String oldDescription = description;
|
|---|
| 184 | description = newDescription;
|
|---|
| 185 | if (eNotificationRequired())
|
|---|
| 186 | eNotify(new ENotificationImpl(this, Notification.SET, DECENTPackage.ATTRIBUTE__DESCRIPTION, oldDescription, description));
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | /**
|
|---|
| 190 | * <!-- begin-user-doc -->
|
|---|
| 191 | * <!-- end-user-doc -->
|
|---|
| 192 | * @generated
|
|---|
| 193 | */
|
|---|
| 194 | @Override
|
|---|
| 195 | public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
|---|
| 196 | switch (featureID) {
|
|---|
| 197 | case DECENTPackage.ATTRIBUTE__ARTIFACT_TYPES:
|
|---|
| 198 | return getArtifactTypes();
|
|---|
| 199 | case DECENTPackage.ATTRIBUTE__TYPE:
|
|---|
| 200 | if (resolve) return getType();
|
|---|
| 201 | return basicGetType();
|
|---|
| 202 | case DECENTPackage.ATTRIBUTE__DIMENSION:
|
|---|
| 203 | return getDimension();
|
|---|
| 204 | case DECENTPackage.ATTRIBUTE__DESCRIPTION:
|
|---|
| 205 | return getDescription();
|
|---|
| 206 | }
|
|---|
| 207 | return super.eGet(featureID, resolve, coreType);
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 | /**
|
|---|
| 211 | * <!-- begin-user-doc -->
|
|---|
| 212 | * <!-- end-user-doc -->
|
|---|
| 213 | * @generated
|
|---|
| 214 | */
|
|---|
| 215 | @SuppressWarnings("unchecked")
|
|---|
| 216 | @Override
|
|---|
| 217 | public void eSet(int featureID, Object newValue) {
|
|---|
| 218 | switch (featureID) {
|
|---|
| 219 | case DECENTPackage.ATTRIBUTE__ARTIFACT_TYPES:
|
|---|
| 220 | getArtifactTypes().clear();
|
|---|
| 221 | getArtifactTypes().addAll((Collection<? extends ArtifactType>)newValue);
|
|---|
| 222 | return;
|
|---|
| 223 | case DECENTPackage.ATTRIBUTE__TYPE:
|
|---|
| 224 | setType((EDataType)newValue);
|
|---|
| 225 | return;
|
|---|
| 226 | case DECENTPackage.ATTRIBUTE__DIMENSION:
|
|---|
| 227 | getDimension().clear();
|
|---|
| 228 | getDimension().addAll((Collection<? extends Dimension>)newValue);
|
|---|
| 229 | return;
|
|---|
| 230 | case DECENTPackage.ATTRIBUTE__DESCRIPTION:
|
|---|
| 231 | setDescription((String)newValue);
|
|---|
| 232 | return;
|
|---|
| 233 | }
|
|---|
| 234 | super.eSet(featureID, newValue);
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | /**
|
|---|
| 238 | * <!-- begin-user-doc -->
|
|---|
| 239 | * <!-- end-user-doc -->
|
|---|
| 240 | * @generated
|
|---|
| 241 | */
|
|---|
| 242 | @Override
|
|---|
| 243 | public void eUnset(int featureID) {
|
|---|
| 244 | switch (featureID) {
|
|---|
| 245 | case DECENTPackage.ATTRIBUTE__ARTIFACT_TYPES:
|
|---|
| 246 | getArtifactTypes().clear();
|
|---|
| 247 | return;
|
|---|
| 248 | case DECENTPackage.ATTRIBUTE__TYPE:
|
|---|
| 249 | setType((EDataType)null);
|
|---|
| 250 | return;
|
|---|
| 251 | case DECENTPackage.ATTRIBUTE__DIMENSION:
|
|---|
| 252 | getDimension().clear();
|
|---|
| 253 | return;
|
|---|
| 254 | case DECENTPackage.ATTRIBUTE__DESCRIPTION:
|
|---|
| 255 | setDescription(DESCRIPTION_EDEFAULT);
|
|---|
| 256 | return;
|
|---|
| 257 | }
|
|---|
| 258 | super.eUnset(featureID);
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | /**
|
|---|
| 262 | * <!-- begin-user-doc -->
|
|---|
| 263 | * <!-- end-user-doc -->
|
|---|
| 264 | * @generated
|
|---|
| 265 | */
|
|---|
| 266 | @Override
|
|---|
| 267 | public boolean eIsSet(int featureID) {
|
|---|
| 268 | switch (featureID) {
|
|---|
| 269 | case DECENTPackage.ATTRIBUTE__ARTIFACT_TYPES:
|
|---|
| 270 | return artifactTypes != null && !artifactTypes.isEmpty();
|
|---|
| 271 | case DECENTPackage.ATTRIBUTE__TYPE:
|
|---|
| 272 | return type != null;
|
|---|
| 273 | case DECENTPackage.ATTRIBUTE__DIMENSION:
|
|---|
| 274 | return dimension != null && !dimension.isEmpty();
|
|---|
| 275 | case DECENTPackage.ATTRIBUTE__DESCRIPTION:
|
|---|
| 276 | return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
|
|---|
| 277 | }
|
|---|
| 278 | return super.eIsSet(featureID);
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 | /**
|
|---|
| 282 | * <!-- begin-user-doc -->
|
|---|
| 283 | * <!-- end-user-doc -->
|
|---|
| 284 | * @generated
|
|---|
| 285 | */
|
|---|
| 286 | @Override
|
|---|
| 287 | public String toString() {
|
|---|
| 288 | if (eIsProxy()) return super.toString();
|
|---|
| 289 |
|
|---|
| 290 | StringBuffer result = new StringBuffer(super.toString());
|
|---|
| 291 | result.append(" (description: ");
|
|---|
| 292 | result.append(description);
|
|---|
| 293 | result.append(')');
|
|---|
| 294 | return result.toString();
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | } //AttributeImpl
|
|---|