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