1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.spa.resourcemodel.impl; |
8 | |
9 | import java.util.Collection; |
10 | |
11 | import org.eclipse.emf.common.notify.NotificationChain; |
12 | import org.eclipse.emf.common.util.EList; |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.InternalEObject; |
15 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
16 | import org.eclipse.emf.ecore.util.InternalEList; |
17 | |
18 | import de.uka.ipd.sdq.spa.resourcemodel.AlternativeResourceUsage; |
19 | import de.uka.ipd.sdq.spa.resourcemodel.Option; |
20 | import de.uka.ipd.sdq.spa.resourcemodel.ResourceModelPackage; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Alternative Resource Usage</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link de.uka.ipd.sdq.spa.resourcemodel.impl.AlternativeResourceUsageImpl#getOptions <em>Options</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class AlternativeResourceUsageImpl extends AbstractResourceUsageImpl implements AlternativeResourceUsage { |
36 | /** |
37 | * The cached value of the '{@link #getOptions() <em>Options</em>}' containment reference list. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @see #getOptions() |
41 | * @generated |
42 | * @ordered |
43 | */ |
44 | protected EList options = null; |
45 | |
46 | /** |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | protected AlternativeResourceUsageImpl() { |
52 | super(); |
53 | } |
54 | |
55 | /** |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | protected EClass eStaticClass() { |
61 | return ResourceModelPackage.Literals.ALTERNATIVE_RESOURCE_USAGE; |
62 | } |
63 | |
64 | /** |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | public EList getOptions() { |
70 | if (options == null) { |
71 | options = new EObjectContainmentEList(Option.class, this, ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS); |
72 | } |
73 | return options; |
74 | } |
75 | |
76 | /** |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
82 | switch (featureID) { |
83 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS: |
84 | return ((InternalEList)getOptions()).basicRemove(otherEnd, msgs); |
85 | } |
86 | return super.eInverseRemove(otherEnd, featureID, msgs); |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
95 | switch (featureID) { |
96 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS: |
97 | return getOptions(); |
98 | } |
99 | return super.eGet(featureID, resolve, coreType); |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public void eSet(int featureID, Object newValue) { |
108 | switch (featureID) { |
109 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS: |
110 | getOptions().clear(); |
111 | getOptions().addAll((Collection)newValue); |
112 | return; |
113 | } |
114 | super.eSet(featureID, newValue); |
115 | } |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | public void eUnset(int featureID) { |
123 | switch (featureID) { |
124 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS: |
125 | getOptions().clear(); |
126 | return; |
127 | } |
128 | super.eUnset(featureID); |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | public boolean eIsSet(int featureID) { |
137 | switch (featureID) { |
138 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE__OPTIONS: |
139 | return options != null && !options.isEmpty(); |
140 | } |
141 | return super.eIsSet(featureID); |
142 | } |
143 | |
144 | } //AlternativeResourceUsageImpl |