1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.impl; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Constraint; |
10 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.QMLContractPackage; |
11 | |
12 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.util.QMLContractValidator; |
13 | |
14 | import java.util.Map; |
15 | |
16 | import org.eclipse.emf.common.util.BasicDiagnostic; |
17 | import org.eclipse.emf.common.util.Diagnostic; |
18 | import org.eclipse.emf.common.util.DiagnosticChain; |
19 | |
20 | import org.eclipse.emf.ecore.EClass; |
21 | |
22 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
23 | |
24 | import org.eclipse.emf.ecore.util.EObjectValidator; |
25 | |
26 | import org.eclipse.ocl.ParserException; |
27 | |
28 | import org.eclipse.ocl.ecore.OCL; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Constraint</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * </p> |
36 | * |
37 | * @generated |
38 | */ |
39 | public class ConstraintImpl extends CriterionImpl implements Constraint { |
40 | /** |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @generated |
44 | */ |
45 | protected ConstraintImpl() { |
46 | super(); |
47 | } |
48 | |
49 | /** |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | @Override |
55 | protected EClass eStaticClass() { |
56 | return QMLContractPackage.Literals.CONSTRAINT; |
57 | } |
58 | |
59 | /** |
60 | * The cached OCL expression body for the '{@link #All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>All ASPECTS of CONSTRAINTS have RESTRICTIONS</em>}' operation. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected static final String ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.aspects->forAll(a|a.aspectRequirement<>null and a.aspectRequirement.oclIsTypeOf(QMLContract::Restriction))"; |
68 | |
69 | /** |
70 | * The cached OCL invariant for the '{@link #All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>All ASPECTS of CONSTRAINTS have RESTRICTIONS</em>}' invariant operation. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @see #All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
74 | * @generated |
75 | * @ordered |
76 | */ |
77 | protected static org.eclipse.ocl.ecore.Constraint ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | public boolean All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS(DiagnosticChain diagnostics, Map<Object, Object> context) { |
85 | if (ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
86 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
87 | helper.setContext(QMLContractPackage.Literals.CONSTRAINT); |
88 | try { |
89 | ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
90 | } |
91 | catch (ParserException pe) { |
92 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
93 | } |
94 | } |
95 | if (!EOCL_ENV.createQuery(ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
96 | if (diagnostics != null) { |
97 | diagnostics.add |
98 | (new BasicDiagnostic |
99 | (Diagnostic.ERROR, |
100 | QMLContractValidator.DIAGNOSTIC_SOURCE, |
101 | QMLContractValidator.CONSTRAINT__ALL_ASPECTS_OF_CONSTRAINTS_HAVE_RESTRICTIONS, |
102 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "All_ASPECTS_of_CONSTRAINTS_have_RESTRICTIONS", EObjectValidator.getObjectLabel(this, context) }), |
103 | new Object [] { this })); |
104 | } |
105 | return false; |
106 | } |
107 | return true; |
108 | } |
109 | |
110 | } //ConstraintImpl |