View | Details | Raw Unified | Return to bug 80307 | Differences between
and this patch

Collapse All | Expand All

(-)orig/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/RegionOperations.java (-26 / +35 lines)
Lines 19-35 Link Here
19
import org.eclipse.emf.common.util.DiagnosticChain;
19
import org.eclipse.emf.common.util.DiagnosticChain;
20
import org.eclipse.emf.common.util.EList;
20
import org.eclipse.emf.common.util.EList;
21
import org.eclipse.emf.common.util.UniqueEList;
21
import org.eclipse.emf.common.util.UniqueEList;
22
23
import org.eclipse.uml2.uml.BehavioredClassifier;
22
import org.eclipse.uml2.uml.BehavioredClassifier;
24
import org.eclipse.uml2.uml.Classifier;
23
import org.eclipse.uml2.uml.Classifier;
25
import org.eclipse.uml2.uml.ProtocolStateMachine;
24
import org.eclipse.uml2.uml.ProtocolStateMachine;
25
import org.eclipse.uml2.uml.Pseudostate;
26
import org.eclipse.uml2.uml.PseudostateKind;
26
import org.eclipse.uml2.uml.RedefinableElement;
27
import org.eclipse.uml2.uml.RedefinableElement;
27
import org.eclipse.uml2.uml.Region;
28
import org.eclipse.uml2.uml.Region;
28
import org.eclipse.uml2.uml.State;
29
import org.eclipse.uml2.uml.State;
29
import org.eclipse.uml2.uml.StateMachine;
30
import org.eclipse.uml2.uml.StateMachine;
30
import org.eclipse.uml2.uml.Transition;
31
import org.eclipse.uml2.uml.Transition;
31
import org.eclipse.uml2.uml.Vertex;
32
import org.eclipse.uml2.uml.Vertex;
32
33
import org.eclipse.uml2.uml.util.UMLValidator;
33
import org.eclipse.uml2.uml.util.UMLValidator;
34
34
35
/**
35
/**
Lines 78-92 Link Here
78
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
78
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
79
	 * @param context The cache of context-specific information.
79
	 * @param context The cache of context-specific information.
80
	 * <!-- end-model-doc -->
80
	 * <!-- end-model-doc -->
81
	 * @generated
81
	 * @generated NOT
82
	 */
82
	 */
83
	public static boolean validateInitialVertex(Region region,
83
	public static boolean validateInitialVertex(Region region,
84
			DiagnosticChain diagnostics, Map<Object, Object> context) {
84
			DiagnosticChain diagnostics, Map<Object, Object> context) {
85
		// TODO: implement this method
85
		int initialVertex = 0;
86
		// -> specify the condition that violates the invariant
86
		for(Vertex vertex : region.getSubvertices()) {
87
		// -> verify the details of the diagnostic, including severity and message
87
			if(vertex instanceof Pseudostate) {
88
		// Ensure that you remove @generated or mark it @generated NOT
88
				if(((Pseudostate)vertex).getKind() == PseudostateKind.INITIAL_LITERAL) {
89
		if (false) {
89
					initialVertex++;
90
				}
91
			}
92
		}
93
		if(initialVertex > 1) {
90
			if (diagnostics != null) {
94
			if (diagnostics != null) {
91
				diagnostics
95
				diagnostics
92
					.add(new BasicDiagnostic(
96
					.add(new BasicDiagnostic(
Lines 115-129 Link Here
115
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
119
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
116
	 * @param context The cache of context-specific information.
120
	 * @param context The cache of context-specific information.
117
	 * <!-- end-model-doc -->
121
	 * <!-- end-model-doc -->
118
	 * @generated
122
	 * @generated NOT
119
	 */
123
	 */
120
	public static boolean validateDeepHistoryVertex(Region region,
124
	public static boolean validateDeepHistoryVertex(Region region,
121
			DiagnosticChain diagnostics, Map<Object, Object> context) {
125
			DiagnosticChain diagnostics, Map<Object, Object> context) {
122
		// TODO: implement this method
126
		int deepHistory = 0;
123
		// -> specify the condition that violates the invariant
127
		for(Vertex vertex : region.getSubvertices()) {
124
		// -> verify the details of the diagnostic, including severity and message
128
			if(vertex instanceof Pseudostate) {
125
		// Ensure that you remove @generated or mark it @generated NOT
129
				if(((Pseudostate)vertex).getKind() == PseudostateKind.SHALLOW_HISTORY_LITERAL) {
126
		if (false) {
130
					deepHistory++;
131
				}
132
			}
133
		}
134
		if(deepHistory > 1) {
127
			if (diagnostics != null) {
135
			if (diagnostics != null) {
128
				diagnostics
136
				diagnostics
129
					.add(new BasicDiagnostic(
137
					.add(new BasicDiagnostic(
Lines 152-166 Link Here
152
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
160
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
153
	 * @param context The cache of context-specific information.
161
	 * @param context The cache of context-specific information.
154
	 * <!-- end-model-doc -->
162
	 * <!-- end-model-doc -->
155
	 * @generated
163
	 * @generated NOT
156
	 */
164
	 */
157
	public static boolean validateShallowHistoryVertex(Region region,
165
	public static boolean validateShallowHistoryVertex(Region region,
158
			DiagnosticChain diagnostics, Map<Object, Object> context) {
166
			DiagnosticChain diagnostics, Map<Object, Object> context) {
159
		// TODO: implement this method
167
		int shallowHistory = 0;
160
		// -> specify the condition that violates the invariant
168
		for(Vertex vertex : region.getSubvertices()) {
161
		// -> verify the details of the diagnostic, including severity and message
169
			if(vertex instanceof Pseudostate) {
162
		// Ensure that you remove @generated or mark it @generated NOT
170
				if(((Pseudostate)vertex).getKind() == PseudostateKind.SHALLOW_HISTORY_LITERAL) {
163
		if (false) {
171
					shallowHistory++;
172
				}
173
			}
174
		}
175
		if(shallowHistory > 1) {
164
			if (diagnostics != null) {
176
			if (diagnostics != null) {
165
				diagnostics
177
				diagnostics
166
					.add(new BasicDiagnostic(
178
					.add(new BasicDiagnostic(
Lines 187-201 Link Here
187
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
199
	 * @param diagnostics The chain of diagnostics to which problems are to be appended.
188
	 * @param context The cache of context-specific information.
200
	 * @param context The cache of context-specific information.
189
	 * <!-- end-model-doc -->
201
	 * <!-- end-model-doc -->
190
	 * @generated
202
	 * @generated NOT
191
	 */
203
	 */
192
	public static boolean validateOwned(Region region,
204
	public static boolean validateOwned(Region region,
193
			DiagnosticChain diagnostics, Map<Object, Object> context) {
205
			DiagnosticChain diagnostics, Map<Object, Object> context) {
194
		// TODO: implement this method
206
		// ownerships must be different
195
		// -> specify the condition that violates the invariant
207
		if((region.getState() != null) == (region.getStateMachine() != null)) {
196
		// -> verify the details of the diagnostic, including severity and message
197
		// Ensure that you remove @generated or mark it @generated NOT
198
		if (false) {
199
			if (diagnostics != null) {
208
			if (diagnostics != null) {
200
				diagnostics
209
				diagnostics
201
					.add(new BasicDiagnostic(
210
					.add(new BasicDiagnostic(

Return to bug 80307