1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.spa.resourcemodel.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
12 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
13 | |
14 | import de.uka.ipd.sdq.spa.resourcemodel.Resource; |
15 | import de.uka.ipd.sdq.spa.resourcemodel.ResourceModelPackage; |
16 | |
17 | /** |
18 | * <!-- begin-user-doc --> |
19 | * An implementation of the model object '<em><b>Resource</b></em>'. |
20 | * <!-- end-user-doc --> |
21 | * <p> |
22 | * The following features are implemented: |
23 | * <ul> |
24 | * <li>{@link de.uka.ipd.sdq.spa.resourcemodel.impl.ResourceImpl#getName <em>Name</em>}</li> |
25 | * <li>{@link de.uka.ipd.sdq.spa.resourcemodel.impl.ResourceImpl#getNumberOfServers <em>Number Of Servers</em>}</li> |
26 | * </ul> |
27 | * </p> |
28 | * |
29 | * @generated |
30 | */ |
31 | public abstract class ResourceImpl extends EObjectImpl implements Resource { |
32 | /** |
33 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @see #getName() |
37 | * @generated |
38 | * @ordered |
39 | */ |
40 | protected static final String NAME_EDEFAULT = ""; |
41 | |
42 | /** |
43 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getName() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected String name = NAME_EDEFAULT; |
51 | |
52 | /** |
53 | * The default value of the '{@link #getNumberOfServers() <em>Number Of Servers</em>}' attribute. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getNumberOfServers() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected static final int NUMBER_OF_SERVERS_EDEFAULT = 0; |
61 | |
62 | /** |
63 | * The cached value of the '{@link #getNumberOfServers() <em>Number Of Servers</em>}' attribute. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @see #getNumberOfServers() |
67 | * @generated |
68 | * @ordered |
69 | */ |
70 | protected int numberOfServers = NUMBER_OF_SERVERS_EDEFAULT; |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected ResourceImpl() { |
78 | super(); |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | protected EClass eStaticClass() { |
87 | return ResourceModelPackage.Literals.RESOURCE; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | public String getName() { |
96 | return name; |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | public void setName(String newName) { |
105 | String oldName = name; |
106 | name = newName; |
107 | if (eNotificationRequired()) |
108 | eNotify(new ENotificationImpl(this, Notification.SET, ResourceModelPackage.RESOURCE__NAME, oldName, name)); |
109 | } |
110 | |
111 | /** |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | public int getNumberOfServers() { |
117 | return numberOfServers; |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | public void setNumberOfServers(int newNumberOfServers) { |
126 | int oldNumberOfServers = numberOfServers; |
127 | numberOfServers = newNumberOfServers; |
128 | if (eNotificationRequired()) |
129 | eNotify(new ENotificationImpl(this, Notification.SET, ResourceModelPackage.RESOURCE__NUMBER_OF_SERVERS, oldNumberOfServers, numberOfServers)); |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
138 | switch (featureID) { |
139 | case ResourceModelPackage.RESOURCE__NAME: |
140 | return getName(); |
141 | case ResourceModelPackage.RESOURCE__NUMBER_OF_SERVERS: |
142 | return new Integer(getNumberOfServers()); |
143 | } |
144 | return super.eGet(featureID, resolve, coreType); |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | public void eSet(int featureID, Object newValue) { |
153 | switch (featureID) { |
154 | case ResourceModelPackage.RESOURCE__NAME: |
155 | setName((String)newValue); |
156 | return; |
157 | case ResourceModelPackage.RESOURCE__NUMBER_OF_SERVERS: |
158 | setNumberOfServers(((Integer)newValue).intValue()); |
159 | return; |
160 | } |
161 | super.eSet(featureID, newValue); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | public void eUnset(int featureID) { |
170 | switch (featureID) { |
171 | case ResourceModelPackage.RESOURCE__NAME: |
172 | setName(NAME_EDEFAULT); |
173 | return; |
174 | case ResourceModelPackage.RESOURCE__NUMBER_OF_SERVERS: |
175 | setNumberOfServers(NUMBER_OF_SERVERS_EDEFAULT); |
176 | return; |
177 | } |
178 | super.eUnset(featureID); |
179 | } |
180 | |
181 | /** |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | public boolean eIsSet(int featureID) { |
187 | switch (featureID) { |
188 | case ResourceModelPackage.RESOURCE__NAME: |
189 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
190 | case ResourceModelPackage.RESOURCE__NUMBER_OF_SERVERS: |
191 | return numberOfServers != NUMBER_OF_SERVERS_EDEFAULT; |
192 | } |
193 | return super.eIsSet(featureID); |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | public String toString() { |
202 | if (eIsProxy()) return super.toString(); |
203 | |
204 | StringBuffer result = new StringBuffer(super.toString()); |
205 | result.append(" (name: "); |
206 | result.append(name); |
207 | result.append(", numberOfServers: "); |
208 | result.append(numberOfServers); |
209 | result.append(')'); |
210 | return result.toString(); |
211 | } |
212 | |
213 | } //ResourceImpl |