1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.system.util; |
7 | |
8 | import java.util.Map; |
9 | |
10 | import org.eclipse.emf.common.util.DiagnosticChain; |
11 | import org.eclipse.emf.common.util.ResourceLocator; |
12 | import org.eclipse.emf.ecore.EPackage; |
13 | import org.eclipse.emf.ecore.util.EObjectValidator; |
14 | |
15 | import de.uka.ipd.sdq.identifier.util.IdentifierValidator; |
16 | import de.uka.ipd.sdq.pcm.core.composition.util.CompositionValidator; |
17 | import de.uka.ipd.sdq.pcm.core.entity.util.EntityValidator; |
18 | import de.uka.ipd.sdq.pcm.system.SystemPackage; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * The <b>Validator</b> for the model. |
23 | * <!-- end-user-doc --> |
24 | * @see de.uka.ipd.sdq.pcm.system.SystemPackage |
25 | * @generated |
26 | */ |
27 | public class SystemValidator extends EObjectValidator { |
28 | /** |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
34 | |
35 | /** |
36 | * The cached model package |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public static final SystemValidator INSTANCE = new SystemValidator(); |
42 | |
43 | /** |
44 | * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
48 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
49 | * @generated |
50 | */ |
51 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.pcm.system"; |
52 | |
53 | /** |
54 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'System Must Have At Least One Provided Role' of 'System'. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | public static final int SYSTEM__SYSTEM_MUST_HAVE_AT_LEAST_ONE_PROVIDED_ROLE = 1; |
60 | |
61 | /** |
62 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1; |
68 | |
69 | /** |
70 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
76 | |
77 | /** |
78 | * The cached base package validator. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected IdentifierValidator identifierValidator; |
84 | |
85 | /** |
86 | * The cached base package validator. |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | protected CompositionValidator compositionValidator; |
92 | |
93 | /** |
94 | * The cached base package validator. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | protected EntityValidator entityValidator; |
100 | |
101 | /** |
102 | * Creates an instance of the switch. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public SystemValidator() { |
108 | super(); |
109 | identifierValidator = IdentifierValidator.INSTANCE; |
110 | compositionValidator = CompositionValidator.INSTANCE; |
111 | entityValidator = EntityValidator.INSTANCE; |
112 | } |
113 | |
114 | /** |
115 | * Returns the package of this validator switch. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | protected EPackage getEPackage() { |
122 | return SystemPackage.eINSTANCE; |
123 | } |
124 | |
125 | /** |
126 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | @Override |
132 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
133 | switch (classifierID) { |
134 | case SystemPackage.SYSTEM: |
135 | return validateSystem((de.uka.ipd.sdq.pcm.system.System)value, diagnostics, context); |
136 | default: |
137 | return true; |
138 | } |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | public boolean validateSystem(de.uka.ipd.sdq.pcm.system.System system, DiagnosticChain diagnostics, Map<Object, Object> context) { |
147 | boolean result = validate_EveryMultiplicityConforms(system, diagnostics, context); |
148 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(system, diagnostics, context); |
149 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(system, diagnostics, context); |
150 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(system, diagnostics, context); |
151 | if (result || diagnostics != null) result &= validate_UniqueID(system, diagnostics, context); |
152 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(system, diagnostics, context); |
153 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(system, diagnostics, context); |
154 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(system, diagnostics, context); |
155 | if (result || diagnostics != null) result &= compositionValidator.validateComposedStructure_MultipleConnectorsConstraint(system, diagnostics, context); |
156 | if (result || diagnostics != null) result &= compositionValidator.validateComposedStructure_MultipleConnectorsConstraintForAssemblyConnectors(system, diagnostics, context); |
157 | if (result || diagnostics != null) result &= entityValidator.validateComposedProvidingRequiringEntity_ProvidedRolesMustBeBound(system, diagnostics, context); |
158 | if (result || diagnostics != null) result &= validateSystem_SystemMustHaveAtLeastOneProvidedRole(system, diagnostics, context); |
159 | return result; |
160 | } |
161 | |
162 | /** |
163 | * Validates the SystemMustHaveAtLeastOneProvidedRole constraint of '<em>System</em>'. |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | public boolean validateSystem_SystemMustHaveAtLeastOneProvidedRole(de.uka.ipd.sdq.pcm.system.System system, DiagnosticChain diagnostics, Map<Object, Object> context) { |
169 | return system.SystemMustHaveAtLeastOneProvidedRole(diagnostics, context); |
170 | } |
171 | |
172 | /** |
173 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | public ResourceLocator getResourceLocator() { |
180 | // TODO |
181 | // Specialize this to return a resource locator for messages specific to this validator. |
182 | // Ensure that you remove @generated or mark it @generated NOT |
183 | return super.getResourceLocator(); |
184 | } |
185 | |
186 | } //SystemValidator |