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