1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.markov.impl; |
8 | |
9 | import de.uka.ipd.sdq.markov.MarkovChain; |
10 | import de.uka.ipd.sdq.markov.MarkovPackage; |
11 | import de.uka.ipd.sdq.markov.State; |
12 | import de.uka.ipd.sdq.markov.Transition; |
13 | |
14 | import java.util.Collection; |
15 | |
16 | import org.eclipse.emf.common.notify.NotificationChain; |
17 | |
18 | import org.eclipse.emf.common.util.EList; |
19 | |
20 | import org.eclipse.emf.ecore.EClass; |
21 | import org.eclipse.emf.ecore.InternalEObject; |
22 | |
23 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
24 | import org.eclipse.emf.ecore.util.InternalEList; |
25 | |
26 | /** |
27 | * <!-- begin-user-doc --> |
28 | * An implementation of the model object '<em><b>Chain</b></em>'. |
29 | * <!-- end-user-doc --> |
30 | * <p> |
31 | * The following features are implemented: |
32 | * <ul> |
33 | * <li>{@link de.uka.ipd.sdq.markov.impl.MarkovChainImpl#getStates <em>States</em>}</li> |
34 | * <li>{@link de.uka.ipd.sdq.markov.impl.MarkovChainImpl#getTransitions <em>Transitions</em>}</li> |
35 | * </ul> |
36 | * </p> |
37 | * |
38 | * @generated |
39 | */ |
40 | public class MarkovChainImpl extends EntityImpl implements MarkovChain { |
41 | /** |
42 | * The cached value of the '{@link #getStates() <em>States</em>}' containment reference list. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @see #getStates() |
46 | * @generated |
47 | * @ordered |
48 | */ |
49 | protected EList<State> states; |
50 | |
51 | /** |
52 | * The cached value of the '{@link #getTransitions() <em>Transitions</em>}' containment reference list. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getTransitions() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected EList<Transition> transitions; |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | protected MarkovChainImpl() { |
67 | super(); |
68 | } |
69 | |
70 | /** |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | @Override |
76 | protected EClass eStaticClass() { |
77 | return MarkovPackage.Literals.MARKOV_CHAIN; |
78 | } |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | public EList<State> getStates() { |
86 | if (states == null) { |
87 | states = new EObjectContainmentEList<State>(State.class, this, MarkovPackage.MARKOV_CHAIN__STATES); |
88 | } |
89 | return states; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | public EList<Transition> getTransitions() { |
98 | if (transitions == null) { |
99 | transitions = new EObjectContainmentEList<Transition>(Transition.class, this, MarkovPackage.MARKOV_CHAIN__TRANSITIONS); |
100 | } |
101 | return transitions; |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
111 | switch (featureID) { |
112 | case MarkovPackage.MARKOV_CHAIN__STATES: |
113 | return ((InternalEList<?>)getStates()).basicRemove(otherEnd, msgs); |
114 | case MarkovPackage.MARKOV_CHAIN__TRANSITIONS: |
115 | return ((InternalEList<?>)getTransitions()).basicRemove(otherEnd, msgs); |
116 | } |
117 | return super.eInverseRemove(otherEnd, featureID, msgs); |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
127 | switch (featureID) { |
128 | case MarkovPackage.MARKOV_CHAIN__STATES: |
129 | return getStates(); |
130 | case MarkovPackage.MARKOV_CHAIN__TRANSITIONS: |
131 | return getTransitions(); |
132 | } |
133 | return super.eGet(featureID, resolve, coreType); |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | @SuppressWarnings("unchecked") |
142 | @Override |
143 | public void eSet(int featureID, Object newValue) { |
144 | switch (featureID) { |
145 | case MarkovPackage.MARKOV_CHAIN__STATES: |
146 | getStates().clear(); |
147 | getStates().addAll((Collection<? extends State>)newValue); |
148 | return; |
149 | case MarkovPackage.MARKOV_CHAIN__TRANSITIONS: |
150 | getTransitions().clear(); |
151 | getTransitions().addAll((Collection<? extends Transition>)newValue); |
152 | return; |
153 | } |
154 | super.eSet(featureID, newValue); |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | @Override |
163 | public void eUnset(int featureID) { |
164 | switch (featureID) { |
165 | case MarkovPackage.MARKOV_CHAIN__STATES: |
166 | getStates().clear(); |
167 | return; |
168 | case MarkovPackage.MARKOV_CHAIN__TRANSITIONS: |
169 | getTransitions().clear(); |
170 | return; |
171 | } |
172 | super.eUnset(featureID); |
173 | } |
174 | |
175 | /** |
176 | * <!-- begin-user-doc --> |
177 | * <!-- end-user-doc --> |
178 | * @generated |
179 | */ |
180 | @Override |
181 | public boolean eIsSet(int featureID) { |
182 | switch (featureID) { |
183 | case MarkovPackage.MARKOV_CHAIN__STATES: |
184 | return states != null && !states.isEmpty(); |
185 | case MarkovPackage.MARKOV_CHAIN__TRANSITIONS: |
186 | return transitions != null && !transitions.isEmpty(); |
187 | } |
188 | return super.eIsSet(featureID); |
189 | } |
190 | |
191 | } //MarkovChainImpl |