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

Collapse All | Expand All

(-)src/org/eclipse/uml2/uml/internal/operations/BehaviorOperations.java (-40 / +60 lines)
Lines 12-28 Link Here
12
 */
12
 */
13
package org.eclipse.uml2.uml.internal.operations;
13
package org.eclipse.uml2.uml.internal.operations;
14
14
15
import java.util.Iterator;
15
import java.util.Map;
16
import java.util.Map;
16
17
17
import org.eclipse.emf.common.util.BasicDiagnostic;
18
import org.eclipse.emf.common.util.BasicDiagnostic;
18
import org.eclipse.emf.common.util.Diagnostic;
19
import org.eclipse.emf.common.util.Diagnostic;
19
import org.eclipse.emf.common.util.DiagnosticChain;
20
import org.eclipse.emf.common.util.DiagnosticChain;
20
21
import org.eclipse.emf.common.util.EList;
21
import org.eclipse.uml2.uml.Behavior;
22
import org.eclipse.uml2.uml.Behavior;
22
import org.eclipse.uml2.uml.UMLPackage;
23
import org.eclipse.uml2.uml.BehavioralFeature;
23
24
import org.eclipse.uml2.uml.BehavioredClassifier;
24
import org.eclipse.uml2.uml.BehavioredClassifier;
25
25
import org.eclipse.uml2.uml.Classifier;
26
import org.eclipse.uml2.uml.Parameter;
27
import org.eclipse.uml2.uml.UMLPackage;
28
import org.eclipse.uml2.uml.UMLPlugin;
26
import org.eclipse.uml2.uml.util.UMLValidator;
29
import org.eclipse.uml2.uml.util.UMLValidator;
27
30
28
/**
31
/**
Lines 62-91 Link Here
62
	 * The parameters of the behavior must match the parameters of the implemented behavioral feature.
65
	 * The parameters of the behavior must match the parameters of the implemented behavioral feature.
63
	 * true
66
	 * true
64
	 * <!-- end-model-doc -->
67
	 * <!-- end-model-doc -->
65
	 * @generated
68
	 * @generated NOT
66
	 */
69
	 */
67
	public static boolean validateParametersMatch(Behavior behavior,
70
	public static boolean validateParametersMatch(Behavior behavior,
68
			DiagnosticChain diagnostics, Map context) {
71
			DiagnosticChain diagnostics, Map context) {
69
		// TODO: implement this method
72
		boolean result = true;
70
		// -> specify the condition that violates the invariant
73
		BehavioralFeature feature = behavior.getSpecification();
71
		// -> verify the details of the diagnostic, including severity and message
74
		if (feature == null) {
72
		// Ensure that you remove @generated or mark it @generated NOT
75
			return result;
73
		if (false) {
76
		}
77
		EList featureParameters = feature.getOwnedParameters();
78
		EList behaviorParameters = behavior.getOwnedParameters();
79
		if (featureParameters.size() != behaviorParameters.size()) {
80
			result = false;
81
		} else {
82
			Iterator parmIter = featureParameters.iterator();
83
			Iterator otherIter = behaviorParameters.iterator();
84
			while (parmIter.hasNext() && otherIter.hasNext()) {
85
				if (!ParameterOperations.conformsTo(
86
					(Parameter) parmIter.next(), (Parameter) otherIter.next())) {
87
					result = false;
88
					break;
89
				}
90
			}
91
		}
92
		if (!result) {
74
			if (diagnostics != null) {
93
			if (diagnostics != null) {
75
				diagnostics
94
				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
76
					.add(new BasicDiagnostic(
95
					UMLValidator.DIAGNOSTIC_SOURCE,
77
						Diagnostic.ERROR,
96
					UMLValidator.BEHAVIOR__PARAMETERS_MATCH, UMLPlugin.INSTANCE
78
						UMLValidator.DIAGNOSTIC_SOURCE,
97
						.getString("_UI_Interface_ParametersMatch_diagnostic", //$NON-NLS-1$
79
						UMLValidator.BEHAVIOR__PARAMETERS_MATCH,
98
							getMessageSubstitutions(context, behavior)),
80
						org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE
99
					new Object[]{behavior}));
81
							.getString(
82
								"_UI_GenericInvariant_diagnostic", new Object[]{"validateParametersMatch", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(behavior, context)}), //$NON-NLS-1$ //$NON-NLS-2$
83
						new Object[]{behavior}));
84
			}
100
			}
85
			return false;
86
		}
101
		}
87
		return true;
102
		return result;
88
	}
103
	}
104
			
89
105
90
	/**
106
	/**
91
	 * <!-- begin-user-doc -->
107
	 * <!-- begin-user-doc -->
Lines 94-122 Link Here
94
	 * The implemented behavioral feature must be a feature (possibly inherited) of the context classifier of the behavior.
110
	 * The implemented behavioral feature must be a feature (possibly inherited) of the context classifier of the behavior.
95
	 * true
111
	 * true
96
	 * <!-- end-model-doc -->
112
	 * <!-- end-model-doc -->
97
	 * @generated
113
	 * @generated NOT
98
	 */
114
	 */
99
	public static boolean validateFeatureOfContextClassifier(Behavior behavior,
115
	public static boolean validateFeatureOfContextClassifier(Behavior behavior,
100
			DiagnosticChain diagnostics, Map context) {
116
			DiagnosticChain diagnostics, Map context) {
101
		// TODO: implement this method
117
		boolean result = true;
102
		// -> specify the condition that violates the invariant
118
		BehavioralFeature feature = behavior.getSpecification();
103
		// -> verify the details of the diagnostic, including severity and message
119
		Classifier contextClassifier = behavior.getContext();
104
		// Ensure that you remove @generated or mark it @generated NOT
120
		if (feature != null) {
105
		if (false) {
121
			result = (contextClassifier != null)
106
			if (diagnostics != null) {
122
				&& contextClassifier.allFeatures().contains(feature);
107
				diagnostics
123
			if (!result) {
108
					.add(new BasicDiagnostic(
124
				if (diagnostics != null) {
109
						Diagnostic.ERROR,
125
					diagnostics
110
						UMLValidator.DIAGNOSTIC_SOURCE,
126
						.add(new BasicDiagnostic(
111
						UMLValidator.BEHAVIOR__FEATURE_OF_CONTEXT_CLASSIFIER,
127
							Diagnostic.WARNING,
112
						org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE
128
							UMLValidator.DIAGNOSTIC_SOURCE,
113
							.getString(
129
							UMLValidator.BEHAVIOR__FEATURE_OF_CONTEXT_CLASSIFIER,
114
								"_UI_GenericInvariant_diagnostic", new Object[]{"validateFeatureOfContextClassifier", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(behavior, context)}), //$NON-NLS-1$ //$NON-NLS-2$
130
							UMLPlugin.INSTANCE
115
						new Object[]{behavior}));
131
								.getString(
132
									"_UI_Interface_FeatureOfContextClassifier_diagnostic", //$NON-NLS-1$
133
									getMessageSubstitutions(context, behavior)),
134
							new Object[]{behavior}));
135
				}
116
			}
136
			}
117
			return false;
118
		}
137
		}
119
		return true;
138
		return result;
120
	}
139
	}
121
140
122
	/**
141
	/**
Lines 182-188 Link Here
182
		}
201
		}
183
		return true;
202
		return true;
184
	}
203
	}
185
204
	 
186
	/**
205
	/**
187
	 * <!-- begin-user-doc -->
206
	 * <!-- begin-user-doc -->
188
	 * <!-- end-user-doc -->
207
	 * <!-- end-user-doc -->
Lines 192-196 Link Here
192
		return (BehavioredClassifier) getOwningElement(behavior,
211
		return (BehavioredClassifier) getOwningElement(behavior,
193
			UMLPackage.Literals.BEHAVIORED_CLASSIFIER, false);
212
			UMLPackage.Literals.BEHAVIORED_CLASSIFIER, false);
194
	}
213
	}
214
		
195
215
196
} // BehaviorOperations
216
} // BehaviorOperations
(-)src/org/eclipse/uml2/uml/internal/operations/InterfaceOperations.java (-21 / +22 lines)
Lines 12-31 Link Here
12
 */
12
 */
13
package org.eclipse.uml2.uml.internal.operations;
13
package org.eclipse.uml2.uml.internal.operations;
14
14
15
import java.util.Iterator;
15
import java.util.Map;
16
import java.util.Map;
16
17
17
import org.eclipse.emf.common.util.BasicDiagnostic;
18
import org.eclipse.emf.common.util.BasicDiagnostic;
18
import org.eclipse.emf.common.util.Diagnostic;
19
import org.eclipse.emf.common.util.Diagnostic;
19
import org.eclipse.emf.common.util.DiagnosticChain;
20
import org.eclipse.emf.common.util.DiagnosticChain;
20
21
import org.eclipse.emf.common.util.EList;
21
import org.eclipse.emf.common.util.EList;
22
22
import org.eclipse.uml2.uml.Feature;
23
import org.eclipse.uml2.uml.Interface;
23
import org.eclipse.uml2.uml.Interface;
24
25
import org.eclipse.uml2.uml.Operation;
24
import org.eclipse.uml2.uml.Operation;
26
import org.eclipse.uml2.uml.Property;
25
import org.eclipse.uml2.uml.Property;
27
import org.eclipse.uml2.uml.Type;
26
import org.eclipse.uml2.uml.Type;
28
27
import org.eclipse.uml2.uml.UMLPlugin;
28
import org.eclipse.uml2.uml.VisibilityKind;
29
import org.eclipse.uml2.uml.util.UMLValidator;
29
import org.eclipse.uml2.uml.util.UMLValidator;
30
30
31
/**
31
/**
Lines 63-91 Link Here
63
	 * The visibility of all features owned by an interface must be public.
63
	 * The visibility of all features owned by an interface must be public.
64
	 * self.feature->forAll(f | f.visibility = #public)
64
	 * self.feature->forAll(f | f.visibility = #public)
65
	 * <!-- end-model-doc -->
65
	 * <!-- end-model-doc -->
66
	 * @generated
66
	 * @generated NOT
67
	 */
67
	 */
68
	public static boolean validateVisibility(Interface interface_,
68
	public static boolean validateVisibility(Interface interface_,
69
			DiagnosticChain diagnostics, Map context) {
69
			DiagnosticChain diagnostics, Map context) {
70
		// TODO: implement this method
70
		boolean result = true;
71
		// -> specify the condition that violates the invariant
71
		for (Iterator iter = interface_.getFeatures().iterator(); iter
72
		// -> verify the details of the diagnostic, including severity and message
72
			.hasNext();) {
73
		// Ensure that you remove @generated or mark it @generated NOT
73
			Feature feature = (Feature) iter.next();
74
		if (false) {
74
			if (feature.getVisibility() != VisibilityKind.PUBLIC_LITERAL) {
75
				result = false;
76
				break;
77
			}
78
		}
79
		if (!result) {
75
			if (diagnostics != null) {
80
			if (diagnostics != null) {
76
				diagnostics
81
				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
77
					.add(new BasicDiagnostic(
82
					UMLValidator.DIAGNOSTIC_SOURCE,
78
						Diagnostic.ERROR,
83
					UMLValidator.INTERFACE__VISIBILITY, UMLPlugin.INSTANCE
79
						UMLValidator.DIAGNOSTIC_SOURCE,
84
						.getString("_UI_Interface_Visibility_diagnostic", //$NON-NLS-1$
80
						UMLValidator.INTERFACE__VISIBILITY,
85
							getMessageSubstitutions(context, interface_)),
81
						org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE
86
					new Object[]{interface_}));
82
							.getString(
83
								"_UI_GenericInvariant_diagnostic", new Object[]{"validateVisibility", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(interface_, context)}), //$NON-NLS-1$ //$NON-NLS-2$
84
						new Object[]{interface_}));
85
			}
87
			}
86
			return false;
87
		}
88
		}
88
		return true;
89
		return result;
89
	}
90
	}
90
91
91
	/**
92
	/**
(-)src/org/eclipse/uml2/uml/internal/operations/ParameterOperations.java (+21 lines)
Lines 347-351 Link Here
347
				UMLPackage.Literals.LITERAL_NULL);
347
				UMLPackage.Literals.LITERAL_NULL);
348
		}
348
		}
349
	}
349
	}
350
	
351
	/**
352
	 * <!-- begin-user-doc -->
353
	 * <!-- end-user-doc -->
354
	 * @generated NOT
355
	 */
356
	public static boolean conformsTo(Parameter a, Parameter b) {
357
		if ((a.getType() == null) || (b.getType() == null)) {
358
			return false;
359
		}
360
		if (!a.getType().conformsTo(b.getType())) {
361
			return false;
362
		}
363
		if (!(a.includesMultiplicity(b) && b.includesMultiplicity(a))) {
364
			return false;
365
		}
366
		if (a.isOrdered() != b.isOrdered()) {
367
			return false;
368
		}
369
		return true;
370
	}
350
371
351
} // ParameterOperations
372
} // ParameterOperations
(-)src/org/eclipse/uml2/uml/internal/impl/ParameterImpl.java (+9 lines)
Lines 658-663 Link Here
658
	public String getDefault() {
658
	public String getDefault() {
659
		return ParameterOperations.getDefault(this);
659
		return ParameterOperations.getDefault(this);
660
	}
660
	}
661
	
662
	/**
663
	 * <!-- begin-user-doc -->
664
	 * <!-- end-user-doc -->
665
	 * @generated NOT
666
	 */
667
	public boolean conformsTo(Parameter otherParameter) {
668
		return ParameterOperations.conformsTo(this, otherParameter);
669
	}
661
670
662
	/**
671
	/**
663
	 * <!-- begin-user-doc -->
672
	 * <!-- begin-user-doc -->
(-)plugin.properties (+7 lines)
Lines 140-146 Link Here
140
_UI_RedefinableElement_RedefinitionConsistent_diagnostic = Redefining element ''{0}'' is not consistent with redefined element ''{1}''.
140
_UI_RedefinableElement_RedefinitionConsistent_diagnostic = Redefining element ''{0}'' is not consistent with redefined element ''{1}''.
141
_UI_RedefinableElement_RedefinitionContextValid_diagnostic = None of the redefinition contexts of redefining element ''{0}'' is a specialization of at least one of the redefinition contexts for redefined element ''{1}''.
141
_UI_RedefinableElement_RedefinitionContextValid_diagnostic = None of the redefinition contexts of redefining element ''{0}'' is a specialization of at least one of the redefinition contexts for redefined element ''{1}''.
142
142
143
_UI_Interface_Visibility_diagnostic = The interface ''{0}''has at least one feature which is not public.
144
_UI_Interface_ParametersMatch_diagnostic = One or more parameters of the behavior ''{0}'' do not match.
145
_UI_Interface_FeatureOfContextClassifier_diagnostic = The behavioral feature ''{0}'' must be a feature of the context classifier of the behavior.
146
		
143
_UI_UseCase_MustHaveName_diagnostic = Use case ''{0}'' must have a name.
147
_UI_UseCase_MustHaveName_diagnostic = Use case ''{0}'' must have a name.
144
_UI_UseCase_BinaryAssociations_diagnostic = Use case ''{0}'' can only be involved in binary associations.
148
_UI_UseCase_BinaryAssociations_diagnostic = Use case ''{0}'' can only be involved in binary associations.
145
_UI_UseCase_NoAssociationToUseCase_diagnostic = Use case ''{0}'' is involved in an association with another use case ''{1}'' having the same subject.
149
_UI_UseCase_NoAssociationToUseCase_diagnostic = Use case ''{0}'' is involved in an association with another use case ''{1}'' having the same subject.
146
_UI_UseCase_CannotIncludeSelf_diagnostic = Use case ''{0}'' cannot include itself.
150
_UI_UseCase_CannotIncludeSelf_diagnostic = Use case ''{0}'' cannot include itself.
151
152
 
153
	

Return to bug 80307