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 | |
13 | import de.uka.ipd.sdq.spa.resourcemodel.ContentionResource; |
14 | import de.uka.ipd.sdq.spa.resourcemodel.ResourceModelPackage; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * An implementation of the model object '<em><b>Contention Resource</b></em>'. |
19 | * <!-- end-user-doc --> |
20 | * <p> |
21 | * The following features are implemented: |
22 | * <ul> |
23 | * <li>{@link de.uka.ipd.sdq.spa.resourcemodel.impl.ContentionResourceImpl#getNumReplicas <em>Num Replicas</em>}</li> |
24 | * </ul> |
25 | * </p> |
26 | * |
27 | * @generated |
28 | */ |
29 | public abstract class ContentionResourceImpl extends ResourceImpl implements ContentionResource { |
30 | /** |
31 | * The default value of the '{@link #getNumReplicas() <em>Num Replicas</em>}' attribute. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @see #getNumReplicas() |
35 | * @generated |
36 | * @ordered |
37 | */ |
38 | protected static final int NUM_REPLICAS_EDEFAULT = 0; |
39 | |
40 | /** |
41 | * The cached value of the '{@link #getNumReplicas() <em>Num Replicas</em>}' attribute. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @see #getNumReplicas() |
45 | * @generated |
46 | * @ordered |
47 | */ |
48 | protected int numReplicas = NUM_REPLICAS_EDEFAULT; |
49 | |
50 | /** |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | protected ContentionResourceImpl() { |
56 | super(); |
57 | } |
58 | |
59 | /** |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | protected EClass eStaticClass() { |
65 | return ResourceModelPackage.Literals.CONTENTION_RESOURCE; |
66 | } |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | public int getNumReplicas() { |
74 | return numReplicas; |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | public void setNumReplicas(int newNumReplicas) { |
83 | int oldNumReplicas = numReplicas; |
84 | numReplicas = newNumReplicas; |
85 | if (eNotificationRequired()) |
86 | eNotify(new ENotificationImpl(this, Notification.SET, ResourceModelPackage.CONTENTION_RESOURCE__NUM_REPLICAS, oldNumReplicas, numReplicas)); |
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.CONTENTION_RESOURCE__NUM_REPLICAS: |
97 | return new Integer(getNumReplicas()); |
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.CONTENTION_RESOURCE__NUM_REPLICAS: |
110 | setNumReplicas(((Integer)newValue).intValue()); |
111 | return; |
112 | } |
113 | super.eSet(featureID, newValue); |
114 | } |
115 | |
116 | /** |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | public void eUnset(int featureID) { |
122 | switch (featureID) { |
123 | case ResourceModelPackage.CONTENTION_RESOURCE__NUM_REPLICAS: |
124 | setNumReplicas(NUM_REPLICAS_EDEFAULT); |
125 | return; |
126 | } |
127 | super.eUnset(featureID); |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public boolean eIsSet(int featureID) { |
136 | switch (featureID) { |
137 | case ResourceModelPackage.CONTENTION_RESOURCE__NUM_REPLICAS: |
138 | return numReplicas != NUM_REPLICAS_EDEFAULT; |
139 | } |
140 | return super.eIsSet(featureID); |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public String toString() { |
149 | if (eIsProxy()) return super.toString(); |
150 | |
151 | StringBuffer result = new StringBuffer(super.toString()); |
152 | result.append(" (numReplicas: "); |
153 | result.append(numReplicas); |
154 | result.append(')'); |
155 | return result.toString(); |
156 | } |
157 | |
158 | } //ContentionResourceImpl |