1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.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.featuremodel.IntegerAttribute; |
14 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * An implementation of the model object '<em><b>Integer Attribute</b></em>'. |
19 | * <!-- end-user-doc --> |
20 | * <p> |
21 | * The following features are implemented: |
22 | * <ul> |
23 | * <li>{@link de.uka.ipd.sdq.featuremodel.impl.IntegerAttributeImpl#getDefaultValue <em>Default Value</em>}</li> |
24 | * </ul> |
25 | * </p> |
26 | * |
27 | * @generated |
28 | */ |
29 | public class IntegerAttributeImpl extends AttributeImpl implements IntegerAttribute { |
30 | /** |
31 | * The default value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @see #getDefaultValue() |
35 | * @generated |
36 | * @ordered |
37 | */ |
38 | protected static final int DEFAULT_VALUE_EDEFAULT = 0; |
39 | |
40 | /** |
41 | * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @see #getDefaultValue() |
45 | * @generated |
46 | * @ordered |
47 | */ |
48 | protected int defaultValue = DEFAULT_VALUE_EDEFAULT; |
49 | |
50 | /** |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | protected IntegerAttributeImpl() { |
56 | super(); |
57 | } |
58 | |
59 | /** |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | @Override |
65 | protected EClass eStaticClass() { |
66 | return featuremodelPackage.Literals.INTEGER_ATTRIBUTE; |
67 | } |
68 | |
69 | /** |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | public int getDefaultValue() { |
75 | return defaultValue; |
76 | } |
77 | |
78 | /** |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | public void setDefaultValue(int newDefaultValue) { |
84 | int oldDefaultValue = defaultValue; |
85 | defaultValue = newDefaultValue; |
86 | if (eNotificationRequired()) |
87 | eNotify(new ENotificationImpl(this, Notification.SET, featuremodelPackage.INTEGER_ATTRIBUTE__DEFAULT_VALUE, oldDefaultValue, defaultValue)); |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | @Override |
96 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
97 | switch (featureID) { |
98 | case featuremodelPackage.INTEGER_ATTRIBUTE__DEFAULT_VALUE: |
99 | return getDefaultValue(); |
100 | } |
101 | return super.eGet(featureID, resolve, coreType); |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | public void eSet(int featureID, Object newValue) { |
111 | switch (featureID) { |
112 | case featuremodelPackage.INTEGER_ATTRIBUTE__DEFAULT_VALUE: |
113 | setDefaultValue((Integer)newValue); |
114 | return; |
115 | } |
116 | super.eSet(featureID, newValue); |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public void eUnset(int featureID) { |
126 | switch (featureID) { |
127 | case featuremodelPackage.INTEGER_ATTRIBUTE__DEFAULT_VALUE: |
128 | setDefaultValue(DEFAULT_VALUE_EDEFAULT); |
129 | return; |
130 | } |
131 | super.eUnset(featureID); |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public boolean eIsSet(int featureID) { |
141 | switch (featureID) { |
142 | case featuremodelPackage.INTEGER_ATTRIBUTE__DEFAULT_VALUE: |
143 | return defaultValue != DEFAULT_VALUE_EDEFAULT; |
144 | } |
145 | return super.eIsSet(featureID); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public String toString() { |
155 | if (eIsProxy()) return super.toString(); |
156 | |
157 | StringBuffer result = new StringBuffer(super.toString()); |
158 | result.append(" (defaultValue: "); |
159 | result.append(defaultValue); |
160 | result.append(')'); |
161 | return result.toString(); |
162 | } |
163 | |
164 | } //IntegerAttributeImpl |