1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resourcerepository.util; |
8 | |
9 | import de.uka.ipd.sdq.pcm.resourcerepository.*; |
10 | |
11 | import java.util.Map; |
12 | |
13 | import org.eclipse.emf.common.util.DiagnosticChain; |
14 | import org.eclipse.emf.common.util.ResourceLocator; |
15 | |
16 | import org.eclipse.emf.ecore.EPackage; |
17 | |
18 | import org.eclipse.emf.ecore.util.EObjectValidator; |
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.resourcerepository.resourcerepositoryPackage |
25 | * @generated |
26 | */ |
27 | public class resourcerepositoryValidator extends EObjectValidator { |
28 | /** |
29 | * The cached model package |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public static final resourcerepositoryValidator INSTANCE = new resourcerepositoryValidator(); |
35 | |
36 | /** |
37 | * 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. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
41 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
42 | * @generated |
43 | */ |
44 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.pcm.resourcerepository"; |
45 | |
46 | /** |
47 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Cost And Resource Must Match' of 'Resource Description'. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public static final int RESOURCE_DESCRIPTION__COST_AND_RESOURCE_MUST_MATCH = 1; |
53 | |
54 | /** |
55 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1; |
61 | |
62 | /** |
63 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
69 | |
70 | /** |
71 | * Creates an instance of the switch. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public resourcerepositoryValidator() { |
77 | super(); |
78 | } |
79 | |
80 | /** |
81 | * Returns the package of this validator switch. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | @Override |
87 | protected EPackage getEPackage() { |
88 | return resourcerepositoryPackage.eINSTANCE; |
89 | } |
90 | |
91 | /** |
92 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
99 | switch (classifierID) { |
100 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION_REPOSITORY: |
101 | return validateResourceDescriptionRepository((ResourceDescriptionRepository)value, diagnostics, context); |
102 | case resourcerepositoryPackage.RESOURCE_DESCRIPTION: |
103 | return validateResourceDescription((ResourceDescription)value, diagnostics, context); |
104 | default: |
105 | return true; |
106 | } |
107 | } |
108 | |
109 | /** |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | public boolean validateResourceDescriptionRepository(ResourceDescriptionRepository resourceDescriptionRepository, DiagnosticChain diagnostics, Map<Object, Object> context) { |
115 | return validate_EveryDefaultConstraint(resourceDescriptionRepository, diagnostics, context); |
116 | } |
117 | |
118 | /** |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | public boolean validateResourceDescription(ResourceDescription resourceDescription, DiagnosticChain diagnostics, Map<Object, Object> context) { |
124 | boolean result = validate_EveryMultiplicityConforms(resourceDescription, diagnostics, context); |
125 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(resourceDescription, diagnostics, context); |
126 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(resourceDescription, diagnostics, context); |
127 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(resourceDescription, diagnostics, context); |
128 | if (result || diagnostics != null) result &= validate_UniqueID(resourceDescription, diagnostics, context); |
129 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(resourceDescription, diagnostics, context); |
130 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(resourceDescription, diagnostics, context); |
131 | if (result || diagnostics != null) result &= validateResourceDescription_CostAndResourceMustMatch(resourceDescription, diagnostics, context); |
132 | return result; |
133 | } |
134 | |
135 | /** |
136 | * Validates the CostAndResourceMustMatch constraint of '<em>Resource Description</em>'. |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | public boolean validateResourceDescription_CostAndResourceMustMatch(ResourceDescription resourceDescription, DiagnosticChain diagnostics, Map<Object, Object> context) { |
142 | return resourceDescription.CostAndResourceMustMatch(diagnostics, context); |
143 | } |
144 | |
145 | /** |
146 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public ResourceLocator getResourceLocator() { |
153 | // TODO |
154 | // Specialize this to return a resource locator for messages specific to this validator. |
155 | // Ensure that you remove @generated or mark it @generated NOT |
156 | return super.getResourceLocator(); |
157 | } |
158 | |
159 | } //resourcerepositoryValidator |