KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > templates > model > ValidatorClass


1 package org.eclipse.emf.codegen.ecore.templates.model;
2
3 import java.util.*;
4 import org.eclipse.emf.codegen.ecore.genmodel.*;
5
6 public class ValidatorClass
7 {
8   protected static String JavaDoc nl;
9   public static synchronized ValidatorClass create(String JavaDoc lineSeparator)
10   {
11     nl = lineSeparator;
12     ValidatorClass result = new ValidatorClass();
13     nl = null;
14     return result;
15   }
16
17   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18   protected final String JavaDoc TEXT_1 = "";
19   protected final String JavaDoc TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * ";
20   protected final String JavaDoc TEXT_3 = "Id";
21   protected final String JavaDoc TEXT_4 = NL + " */" + NL + "package ";
22   protected final String JavaDoc TEXT_5 = ";" + NL;
23   protected final String JavaDoc TEXT_6 = NL + NL + "/**" + NL + " * <!-- begin-user-doc -->" + NL + " * The <b>Validator</b> for the model." + NL + " * <!-- end-user-doc -->" + NL + " * @see ";
24   protected final String JavaDoc TEXT_7 = NL + " * @generated" + NL + " */" + NL + "public class ";
25   protected final String JavaDoc TEXT_8 = " extends ";
26   protected final String JavaDoc TEXT_9 = NL + "{";
27   protected final String JavaDoc TEXT_10 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
28   protected final String JavaDoc TEXT_11 = " copyright = \"";
29   protected final String JavaDoc TEXT_12 = "\";";
30   protected final String JavaDoc TEXT_13 = NL;
31   protected final String JavaDoc TEXT_14 = NL + "\t/**" + NL + "\t * The cached model package" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
32   protected final String JavaDoc TEXT_15 = " INSTANCE = new ";
33   protected final String JavaDoc TEXT_16 = "();" + NL + "" + NL + "\t/**" + NL + "\t * 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." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @see org.eclipse.emf.common.util.Diagnostic#getSource()" + NL + "\t * @see org.eclipse.emf.common.util.Diagnostic#getCode()" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String DIAGNOSTIC_SOURCE = \"";
34   protected final String JavaDoc TEXT_17 = "\";";
35   protected final String JavaDoc TEXT_18 = NL;
36   protected final String JavaDoc TEXT_19 = NL + "\t/**" + NL + "\t * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint '";
37   protected final String JavaDoc TEXT_20 = "' of '";
38   protected final String JavaDoc TEXT_21 = "'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final int ";
39   protected final String JavaDoc TEXT_22 = " = ";
40   protected final String JavaDoc TEXT_23 = ";" + NL;
41   protected final String JavaDoc TEXT_24 = NL + "\t/**" + NL + "\t * A constant with a fixed name that can be used as the base value for additional hand written constants." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final int GENERATED_DIAGNOSTIC_CODE_COUNT = ";
42   protected final String JavaDoc TEXT_25 = ";" + NL + "" + NL + "\t/**" + NL + "\t * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;" + NL;
43   protected final String JavaDoc TEXT_26 = NL + "\t/**" + NL + "\t * The cached base package validator." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
44   protected final String JavaDoc TEXT_27 = " ";
45   protected final String JavaDoc TEXT_28 = "Validator;" + NL;
46   protected final String JavaDoc TEXT_29 = NL + "\t/**" + NL + "\t * Creates an instance of the switch." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
47   protected final String JavaDoc TEXT_30 = "()" + NL + "\t{" + NL + "\t\tsuper();";
48   protected final String JavaDoc TEXT_31 = NL + "\t\t";
49   protected final String JavaDoc TEXT_32 = "Validator = ";
50   protected final String JavaDoc TEXT_33 = ".INSTANCE;";
51   protected final String JavaDoc TEXT_34 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns the package of this validator switch." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EPackage getEPackage()" + NL + "\t{" + NL + "\t return ";
52   protected final String JavaDoc TEXT_35 = ".eINSTANCE;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Calls <code>validateXXX</code> for the corresonding classifier of the model." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context)" + NL + "\t{" + NL + "\t\tswitch (classifierID)" + NL + "\t\t{";
53   protected final String JavaDoc TEXT_36 = NL + "\t\t\tcase ";
54   protected final String JavaDoc TEXT_37 = ".";
55   protected final String JavaDoc TEXT_38 = ":";
56   protected final String JavaDoc TEXT_39 = NL + "\t\t\t\treturn validate";
57   protected final String JavaDoc TEXT_40 = "(((";
58   protected final String JavaDoc TEXT_41 = ")value).";
59   protected final String JavaDoc TEXT_42 = "(), diagnostics, context);";
60   protected final String JavaDoc TEXT_43 = NL + "\t\t\t\treturn validate";
61   protected final String JavaDoc TEXT_44 = "(value, diagnostics, context);";
62   protected final String JavaDoc TEXT_45 = NL + "\t\t\t\treturn validate";
63   protected final String JavaDoc TEXT_46 = "((";
64   protected final String JavaDoc TEXT_47 = ")value, diagnostics, context);";
65   protected final String JavaDoc TEXT_48 = NL + "\t\t\t\treturn validate";
66   protected final String JavaDoc TEXT_49 = "((";
67   protected final String JavaDoc TEXT_50 = ")value, diagnostics, context);";
68   protected final String JavaDoc TEXT_51 = NL + "\t\t\tdefault: " + NL + "\t\t\t\treturn true;" + NL + "\t\t}" + NL + "\t}" + NL;
69   protected final String JavaDoc TEXT_52 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean validate";
70   protected final String JavaDoc TEXT_53 = "(";
71   protected final String JavaDoc TEXT_54 = " ";
72   protected final String JavaDoc TEXT_55 = ", DiagnosticChain ";
73   protected final String JavaDoc TEXT_56 = ", Map ";
74   protected final String JavaDoc TEXT_57 = ")" + NL + "\t{";
75   protected final String JavaDoc TEXT_58 = NL + "\t\treturn true;";
76   protected final String JavaDoc TEXT_59 = NL + "\t\treturn validate_EveryDefaultConstraint(";
77   protected final String JavaDoc TEXT_60 = "(";
78   protected final String JavaDoc TEXT_61 = ")";
79   protected final String JavaDoc TEXT_62 = ", ";
80   protected final String JavaDoc TEXT_63 = ", ";
81   protected final String JavaDoc TEXT_64 = ");";
82   protected final String JavaDoc TEXT_65 = NL + "\t\tboolean ";
83   protected final String JavaDoc TEXT_66 = " = ";
84   protected final String JavaDoc TEXT_67 = "validate";
85   protected final String JavaDoc TEXT_68 = "_";
86   protected final String JavaDoc TEXT_69 = "(";
87   protected final String JavaDoc TEXT_70 = ", ";
88   protected final String JavaDoc TEXT_71 = ", ";
89   protected final String JavaDoc TEXT_72 = ");";
90   protected final String JavaDoc TEXT_73 = NL + "\t\tif (";
91   protected final String JavaDoc TEXT_74 = " || ";
92   protected final String JavaDoc TEXT_75 = " != null) result &= ";
93   protected final String JavaDoc TEXT_76 = "validate";
94   protected final String JavaDoc TEXT_77 = "_";
95   protected final String JavaDoc TEXT_78 = "(";
96   protected final String JavaDoc TEXT_79 = ", ";
97   protected final String JavaDoc TEXT_80 = ", ";
98   protected final String JavaDoc TEXT_81 = ");";
99   protected final String JavaDoc TEXT_82 = NL + "\t\treturn ";
100   protected final String JavaDoc TEXT_83 = ";";
101   protected final String JavaDoc TEXT_84 = NL + "\t}" + NL;
102   protected final String JavaDoc TEXT_85 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
103   protected final String JavaDoc TEXT_86 = "_";
104   protected final String JavaDoc TEXT_87 = NL + "\t */" + NL + "\tpublic static final ";
105   protected final String JavaDoc TEXT_88 = " ";
106   protected final String JavaDoc TEXT_89 = "__VALUE = ";
107   protected final String JavaDoc TEXT_90 = ";" + NL;
108   protected final String JavaDoc TEXT_91 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
109   protected final String JavaDoc TEXT_92 = "_";
110   protected final String JavaDoc TEXT_93 = NL + "\t */" + NL + "\tpublic static final ";
111   protected final String JavaDoc TEXT_94 = " ";
112   protected final String JavaDoc TEXT_95 = "__VALUE = ";
113   protected final String JavaDoc TEXT_96 = ";" + NL;
114   protected final String JavaDoc TEXT_97 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
115   protected final String JavaDoc TEXT_98 = "_";
116   protected final String JavaDoc TEXT_99 = NL + "\t */" + NL + "\tpublic static final ";
117   protected final String JavaDoc TEXT_100 = " ";
118   protected final String JavaDoc TEXT_101 = "__UPPER_BOUND = ";
119   protected final String JavaDoc TEXT_102 = ";" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
120   protected final String JavaDoc TEXT_103 = "_";
121   protected final String JavaDoc TEXT_104 = NL + "\t */" + NL + "\tpublic static final ";
122   protected final String JavaDoc TEXT_105 = " ";
123   protected final String JavaDoc TEXT_106 = "__LOWER_BOUND = ";
124   protected final String JavaDoc TEXT_107 = ";" + NL;
125   protected final String JavaDoc TEXT_108 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
126   protected final String JavaDoc TEXT_109 = "_";
127   protected final String JavaDoc TEXT_110 = NL + "\t */" + NL + "\tpublic static final PatternMatcher [][] ";
128   protected final String JavaDoc TEXT_111 = "__VALUES =" + NL + "\t\tnew PatternMatcher [][] " + NL + "\t\t{";
129   protected final String JavaDoc TEXT_112 = NL + "\t\t\tnew PatternMatcher [] " + NL + "\t\t\t{";
130   protected final String JavaDoc TEXT_113 = NL + "\t\t\t\t";
131   protected final String JavaDoc TEXT_114 = ".createPatternMatcher(";
132   protected final String JavaDoc TEXT_115 = ")";
133   protected final String JavaDoc TEXT_116 = NL + "\t\t\t}";
134   protected final String JavaDoc TEXT_117 = NL + "\t\t};" + NL;
135   protected final String JavaDoc TEXT_118 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t * @see #validate";
136   protected final String JavaDoc TEXT_119 = "_";
137   protected final String JavaDoc TEXT_120 = NL + "\t */" + NL + "\tpublic static final ";
138   protected final String JavaDoc TEXT_121 = " ";
139   protected final String JavaDoc TEXT_122 = "__VALUES =" + NL + "\t\twrapEnumerationValues" + NL + "\t\t\t(new Object[] " + NL + "\t\t\t {";
140   protected final String JavaDoc TEXT_123 = NL + "\t\t\t\t ";
141   protected final String JavaDoc TEXT_124 = "new ";
142   protected final String JavaDoc TEXT_125 = "(";
143   protected final String JavaDoc TEXT_126 = ")";
144   protected final String JavaDoc TEXT_127 = NL + "\t\t\t });" + NL;
145   protected final String JavaDoc TEXT_128 = NL + "\t/**" + NL + "\t * Validates the ";
146   protected final String JavaDoc TEXT_129 = " constraint of '<em>";
147   protected final String JavaDoc TEXT_130 = "</em>'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean validate";
148   protected final String JavaDoc TEXT_131 = "_";
149   protected final String JavaDoc TEXT_132 = "(";
150   protected final String JavaDoc TEXT_133 = " ";
151   protected final String JavaDoc TEXT_134 = ", DiagnosticChain ";
152   protected final String JavaDoc TEXT_135 = ", Map ";
153   protected final String JavaDoc TEXT_136 = ")" + NL + "\t{";
154   protected final String JavaDoc TEXT_137 = NL + "\t\tboolean ";
155   protected final String JavaDoc TEXT_138 = " = true;" + NL + "\t\tfor (";
156   protected final String JavaDoc TEXT_139 = " i = ";
157   protected final String JavaDoc TEXT_140 = ".iterator(); i.hasNext() && (result || diagnostics != null); )" + NL + "\t\t{" + NL + "\t\t\tObject item = i.next();" + NL + "\t\t\tif (";
158   protected final String JavaDoc TEXT_141 = ".eINSTANCE.get";
159   protected final String JavaDoc TEXT_142 = "().isInstance(item))" + NL + "\t\t\t{" + NL + "\t\t\t\tresult &= ";
160   protected final String JavaDoc TEXT_143 = "validate";
161   protected final String JavaDoc TEXT_144 = "(";
162   protected final String JavaDoc TEXT_145 = "(";
163   protected final String JavaDoc TEXT_146 = "(";
164   protected final String JavaDoc TEXT_147 = ")";
165   protected final String JavaDoc TEXT_148 = ").";
166   protected final String JavaDoc TEXT_149 = "()";
167   protected final String JavaDoc TEXT_150 = ", ";
168   protected final String JavaDoc TEXT_151 = ", ";
169   protected final String JavaDoc TEXT_152 = ");" + NL + "\t\t\t}" + NL + "\t\t\telse" + NL + "\t\t\t{" + NL + "\t\t\t\tresult = false;" + NL + "\t\t\t\treportDataValueTypeViolation(";
170   protected final String JavaDoc TEXT_153 = ".eINSTANCE.get";
171   protected final String JavaDoc TEXT_154 = "(), item, ";
172   protected final String JavaDoc TEXT_155 = ", ";
173   protected final String JavaDoc TEXT_156 = ");" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t return result;";
174   protected final String JavaDoc TEXT_157 = NL + "\t\tboolean ";
175   protected final String JavaDoc TEXT_158 = " = true;";
176   protected final String JavaDoc TEXT_159 = NL + "\t\t";
177   protected final String JavaDoc TEXT_160 = "else ";
178   protected final String JavaDoc TEXT_161 = "if (";
179   protected final String JavaDoc TEXT_162 = ".eINSTANCE.get";
180   protected final String JavaDoc TEXT_163 = "().isInstance(";
181   protected final String JavaDoc TEXT_164 = "))" + NL + "\t\t{" + NL + "\t\t\tresult &= ";
182   protected final String JavaDoc TEXT_165 = "validate";
183   protected final String JavaDoc TEXT_166 = "(";
184   protected final String JavaDoc TEXT_167 = "(";
185   protected final String JavaDoc TEXT_168 = "(";
186   protected final String JavaDoc TEXT_169 = ")";
187   protected final String JavaDoc TEXT_170 = ").";
188   protected final String JavaDoc TEXT_171 = "()";
189   protected final String JavaDoc TEXT_172 = ", ";
190   protected final String JavaDoc TEXT_173 = ", ";
191   protected final String JavaDoc TEXT_174 = ");" + NL + "\t\t}";
192   protected final String JavaDoc TEXT_175 = NL + "\t return result;";
193   protected final String JavaDoc TEXT_176 = NL + "\t\treturn validatePattern(";
194   protected final String JavaDoc TEXT_177 = ".eINSTANCE.get";
195   protected final String JavaDoc TEXT_178 = "(), ";
196   protected final String JavaDoc TEXT_179 = "new ";
197   protected final String JavaDoc TEXT_180 = "(";
198   protected final String JavaDoc TEXT_181 = ")";
199   protected final String JavaDoc TEXT_182 = ", ";
200   protected final String JavaDoc TEXT_183 = "__VALUES, ";
201   protected final String JavaDoc TEXT_184 = ", ";
202   protected final String JavaDoc TEXT_185 = ");";
203   protected final String JavaDoc TEXT_186 = NL + "\t\t";
204   protected final String JavaDoc TEXT_187 = " ";
205   protected final String JavaDoc TEXT_188 = " = new ";
206   protected final String JavaDoc TEXT_189 = "(";
207   protected final String JavaDoc TEXT_190 = ");";
208   protected final String JavaDoc TEXT_191 = NL + "\t\tboolean ";
209   protected final String JavaDoc TEXT_192 = " = ";
210   protected final String JavaDoc TEXT_193 = "__VALUES.contains(";
211   protected final String JavaDoc TEXT_194 = ");" + NL + "\t\tif (!";
212   protected final String JavaDoc TEXT_195 = " && ";
213   protected final String JavaDoc TEXT_196 = " != null) " + NL + "\t\t\treportEnumerationViolation(";
214   protected final String JavaDoc TEXT_197 = ".eINSTANCE.get";
215   protected final String JavaDoc TEXT_198 = "(), ";
216   protected final String JavaDoc TEXT_199 = ", ";
217   protected final String JavaDoc TEXT_200 = "__VALUES, ";
218   protected final String JavaDoc TEXT_201 = ", ";
219   protected final String JavaDoc TEXT_202 = ");" + NL + "\t\treturn ";
220   protected final String JavaDoc TEXT_203 = "; ";
221   protected final String JavaDoc TEXT_204 = NL + "\t\tboolean ";
222   protected final String JavaDoc TEXT_205 = " = ";
223   protected final String JavaDoc TEXT_206 = " ";
224   protected final String JavaDoc TEXT_207 = " ";
225   protected final String JavaDoc TEXT_208 = "__VALUE;" + NL + "\t\tif (!";
226   protected final String JavaDoc TEXT_209 = " && ";
227   protected final String JavaDoc TEXT_210 = " != null) " + NL + "\t\t\treportMinViolation(";
228   protected final String JavaDoc TEXT_211 = ".eINSTANCE.get";
229   protected final String JavaDoc TEXT_212 = "(), new ";
230   protected final String JavaDoc TEXT_213 = "(";
231   protected final String JavaDoc TEXT_214 = "), new ";
232   protected final String JavaDoc TEXT_215 = "(";
233   protected final String JavaDoc TEXT_216 = "__VALUE), ";
234   protected final String JavaDoc TEXT_217 = ", ";
235   protected final String JavaDoc TEXT_218 = ", ";
236   protected final String JavaDoc TEXT_219 = ");" + NL + "\t\treturn ";
237   protected final String JavaDoc TEXT_220 = ";";
238   protected final String JavaDoc TEXT_221 = NL + "\t\tint ";
239   protected final String JavaDoc TEXT_222 = " = ";
240   protected final String JavaDoc TEXT_223 = ".compareCalendar(";
241   protected final String JavaDoc TEXT_224 = ", ";
242   protected final String JavaDoc TEXT_225 = "__VALUE);" + NL + "\t\tboolean ";
243   protected final String JavaDoc TEXT_226 = " = ";
244   protected final String JavaDoc TEXT_227 = " == 0 || ";
245   protected final String JavaDoc TEXT_228 = " == 1;";
246   protected final String JavaDoc TEXT_229 = NL + "\t\tint ";
247   protected final String JavaDoc TEXT_230 = " = ";
248   protected final String JavaDoc TEXT_231 = ".compareDuration(";
249   protected final String JavaDoc TEXT_232 = ", ";
250   protected final String JavaDoc TEXT_233 = "__VALUE);" + NL + "\t\tboolean ";
251   protected final String JavaDoc TEXT_234 = " = ";
252   protected final String JavaDoc TEXT_235 = " == 0 || ";
253   protected final String JavaDoc TEXT_236 = " == 1;";
254   protected final String JavaDoc TEXT_237 = NL + "\t\tboolean ";
255   protected final String JavaDoc TEXT_238 = " = ";
256   protected final String JavaDoc TEXT_239 = ".compareTo(";
257   protected final String JavaDoc TEXT_240 = "__VALUE) ";
258   protected final String JavaDoc TEXT_241 = " 0;";
259   protected final String JavaDoc TEXT_242 = NL + "\t\tif (!";
260   protected final String JavaDoc TEXT_243 = " && ";
261   protected final String JavaDoc TEXT_244 = " != null) " + NL + "\t\t\treportMinViolation(";
262   protected final String JavaDoc TEXT_245 = ".eINSTANCE.get";
263   protected final String JavaDoc TEXT_246 = "(), ";
264   protected final String JavaDoc TEXT_247 = ", ";
265   protected final String JavaDoc TEXT_248 = "__VALUE, ";
266   protected final String JavaDoc TEXT_249 = ", ";
267   protected final String JavaDoc TEXT_250 = ", ";
268   protected final String JavaDoc TEXT_251 = ");" + NL + "\t\treturn ";
269   protected final String JavaDoc TEXT_252 = "; ";
270   protected final String JavaDoc TEXT_253 = NL + "\t\tboolean ";
271   protected final String JavaDoc TEXT_254 = " = ";
272   protected final String JavaDoc TEXT_255 = " ";
273   protected final String JavaDoc TEXT_256 = " ";
274   protected final String JavaDoc TEXT_257 = "__VALUE;" + NL + "\t\tif (!";
275   protected final String JavaDoc TEXT_258 = " && ";
276   protected final String JavaDoc TEXT_259 = " != null) " + NL + "\t\t\treportMaxViolation(";
277   protected final String JavaDoc TEXT_260 = ".eINSTANCE.get";
278   protected final String JavaDoc TEXT_261 = "(), new ";
279   protected final String JavaDoc TEXT_262 = "(";
280   protected final String JavaDoc TEXT_263 = "), new ";
281   protected final String JavaDoc TEXT_264 = "(";
282   protected final String JavaDoc TEXT_265 = "__VALUE), ";
283   protected final String JavaDoc TEXT_266 = ", ";
284   protected final String JavaDoc TEXT_267 = ", ";
285   protected final String JavaDoc TEXT_268 = ");" + NL + "\t\treturn ";
286   protected final String JavaDoc TEXT_269 = "; ";
287   protected final String JavaDoc TEXT_270 = NL + "\t\tint ";
288   protected final String JavaDoc TEXT_271 = " = ";
289   protected final String JavaDoc TEXT_272 = ".compareCalendar(";
290   protected final String JavaDoc TEXT_273 = ", ";
291   protected final String JavaDoc TEXT_274 = "__VALUE);" + NL + "\t\tboolean ";
292   protected final String JavaDoc TEXT_275 = " = ";
293   protected final String JavaDoc TEXT_276 = " == 0 || ";
294   protected final String JavaDoc TEXT_277 = " == -1;";
295   protected final String JavaDoc TEXT_278 = NL + "\t\tint ";
296   protected final String JavaDoc TEXT_279 = " = ";
297   protected final String JavaDoc TEXT_280 = ".compareDuration(";
298   protected final String JavaDoc TEXT_281 = ", ";
299   protected final String JavaDoc TEXT_282 = "__VALUE);" + NL + "\t\tboolean ";
300   protected final String JavaDoc TEXT_283 = " = ";
301   protected final String JavaDoc TEXT_284 = " == 0 || ";
302   protected final String JavaDoc TEXT_285 = " == -1;";
303   protected final String JavaDoc TEXT_286 = NL + "\t\tboolean ";
304   protected final String JavaDoc TEXT_287 = " = ";
305   protected final String JavaDoc TEXT_288 = ".compareTo(";
306   protected final String JavaDoc TEXT_289 = "__VALUE) ";
307   protected final String JavaDoc TEXT_290 = " 0;";
308   protected final String JavaDoc TEXT_291 = NL + "\t\tif (!";
309   protected final String JavaDoc TEXT_292 = " && ";
310   protected final String JavaDoc TEXT_293 = " != null) " + NL + "\t\t\treportMaxViolation(";
311   protected final String JavaDoc TEXT_294 = ".eINSTANCE.get";
312   protected final String JavaDoc TEXT_295 = "(), ";
313   protected final String JavaDoc TEXT_296 = ", ";
314   protected final String JavaDoc TEXT_297 = "__VALUE, ";
315   protected final String JavaDoc TEXT_298 = ", ";
316   protected final String JavaDoc TEXT_299 = ", ";
317   protected final String JavaDoc TEXT_300 = ");" + NL + "\t\treturn ";
318   protected final String JavaDoc TEXT_301 = "; ";
319   protected final String JavaDoc TEXT_302 = NL + "\t\tint length = ";
320   protected final String JavaDoc TEXT_303 = ".";
321   protected final String JavaDoc TEXT_304 = "; " + NL + "\t\tboolean ";
322   protected final String JavaDoc TEXT_305 = " = length >= ";
323   protected final String JavaDoc TEXT_306 = ";" + NL + "\t\tif (!";
324   protected final String JavaDoc TEXT_307 = " && ";
325   protected final String JavaDoc TEXT_308 = " != null) " + NL + "\t\t\treportMinLengthViolation(";
326   protected final String JavaDoc TEXT_309 = ".eINSTANCE.get";
327   protected final String JavaDoc TEXT_310 = "(), ";
328   protected final String JavaDoc TEXT_311 = ", length, ";
329   protected final String JavaDoc TEXT_312 = ", ";
330   protected final String JavaDoc TEXT_313 = ", ";
331   protected final String JavaDoc TEXT_314 = ");" + NL + "\t\treturn ";
332   protected final String JavaDoc TEXT_315 = ";";
333   protected final String JavaDoc TEXT_316 = NL + "\t\tint length = ";
334   protected final String JavaDoc TEXT_317 = ".";
335   protected final String JavaDoc TEXT_318 = "; " + NL + "\t\tboolean ";
336   protected final String JavaDoc TEXT_319 = " = length <= ";
337   protected final String JavaDoc TEXT_320 = ";" + NL + "\t\tif (!";
338   protected final String JavaDoc TEXT_321 = " && ";
339   protected final String JavaDoc TEXT_322 = " != null) " + NL + "\t\t\treportMaxLengthViolation(";
340   protected final String JavaDoc TEXT_323 = ".eINSTANCE.get";
341   protected final String JavaDoc TEXT_324 = "(), ";
342   protected final String JavaDoc TEXT_325 = ", length, ";
343   protected final String JavaDoc TEXT_326 = ", ";
344   protected final String JavaDoc TEXT_327 = ", ";
345   protected final String JavaDoc TEXT_328 = ");" + NL + "\t\treturn ";
346   protected final String JavaDoc TEXT_329 = ";";
347   protected final String JavaDoc TEXT_330 = NL + "\t\tboolean ";
348   protected final String JavaDoc TEXT_331 = " = ";
349   protected final String JavaDoc TEXT_332 = " > ";
350   protected final String JavaDoc TEXT_333 = "__LOWER_BOUND && ";
351   protected final String JavaDoc TEXT_334 = " < ";
352   protected final String JavaDoc TEXT_335 = "__UPPER_BOUND;" + NL + "\t\tif (!";
353   protected final String JavaDoc TEXT_336 = " && ";
354   protected final String JavaDoc TEXT_337 = " != null) " + NL + "\t\t\treportTotalDigitsViolation(";
355   protected final String JavaDoc TEXT_338 = ".eINSTANCE.get";
356   protected final String JavaDoc TEXT_339 = "(), new ";
357   protected final String JavaDoc TEXT_340 = "(";
358   protected final String JavaDoc TEXT_341 = "), ";
359   protected final String JavaDoc TEXT_342 = ", ";
360   protected final String JavaDoc TEXT_343 = ", ";
361   protected final String JavaDoc TEXT_344 = ");";
362   protected final String JavaDoc TEXT_345 = NL + "\t\tboolean ";
363   protected final String JavaDoc TEXT_346 = " = ";
364   protected final String JavaDoc TEXT_347 = ".unscaledValue().abs().toString().length() <= ";
365   protected final String JavaDoc TEXT_348 = ";" + NL + "\t\tif (!";
366   protected final String JavaDoc TEXT_349 = " && ";
367   protected final String JavaDoc TEXT_350 = " != null) " + NL + "\t\t\treportTotalDigitsViolation(";
368   protected final String JavaDoc TEXT_351 = ".eINSTANCE.get";
369   protected final String JavaDoc TEXT_352 = "(), ";
370   protected final String JavaDoc TEXT_353 = ", ";
371   protected final String JavaDoc TEXT_354 = ", ";
372   protected final String JavaDoc TEXT_355 = ", ";
373   protected final String JavaDoc TEXT_356 = ");";
374   protected final String JavaDoc TEXT_357 = NL + "\t\tboolean ";
375   protected final String JavaDoc TEXT_358 = " = ";
376   protected final String JavaDoc TEXT_359 = ".compareTo(";
377   protected final String JavaDoc TEXT_360 = "__LOWER_BOUND) > 0 && ";
378   protected final String JavaDoc TEXT_361 = ".compareTo(";
379   protected final String JavaDoc TEXT_362 = "__UPPER_BOUND) < 0;" + NL + "\t\tif (!";
380   protected final String JavaDoc TEXT_363 = " && ";
381   protected final String JavaDoc TEXT_364 = " != null) " + NL + "\t\t\treportTotalDigitsViolation(";
382   protected final String JavaDoc TEXT_365 = ".eINSTANCE.get";
383   protected final String JavaDoc TEXT_366 = "(), ";
384   protected final String JavaDoc TEXT_367 = ", ";
385   protected final String JavaDoc TEXT_368 = ", ";
386   protected final String JavaDoc TEXT_369 = ", ";
387   protected final String JavaDoc TEXT_370 = ");";
388   protected final String JavaDoc TEXT_371 = NL + "\t\treturn ";
389   protected final String JavaDoc TEXT_372 = "; ";
390   protected final String JavaDoc TEXT_373 = NL + "\t\tboolean ";
391   protected final String JavaDoc TEXT_374 = " = ";
392   protected final String JavaDoc TEXT_375 = ".scale() <= ";
393   protected final String JavaDoc TEXT_376 = ";" + NL + "\t\tif (!";
394   protected final String JavaDoc TEXT_377 = " && ";
395   protected final String JavaDoc TEXT_378 = " != null) " + NL + "\t\t\treportFractionDigitsViolation(";
396   protected final String JavaDoc TEXT_379 = ".eINSTANCE.get";
397   protected final String JavaDoc TEXT_380 = "(), ";
398   protected final String JavaDoc TEXT_381 = ", ";
399   protected final String JavaDoc TEXT_382 = ", ";
400   protected final String JavaDoc TEXT_383 = ", ";
401   protected final String JavaDoc TEXT_384 = ");" + NL + "\t\treturn ";
402   protected final String JavaDoc TEXT_385 = "; ";
403   protected final String JavaDoc TEXT_386 = NL + "\t\t// TODO override the constraint, if desired" + NL + "\t\t// -> uncomment the scaffolding" + NL + "\t\t// -> specify the condition that violates the constraint" + NL + "\t\t// -> verify the diagnostic details, including severity, code, and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif (";
404   protected final String JavaDoc TEXT_387 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t";
405   protected final String JavaDoc TEXT_388 = ".add" + NL + "\t\t\t\t\t(new ";
406   protected final String JavaDoc TEXT_389 = NL + "\t\t\t\t\t\t(";
407   protected final String JavaDoc TEXT_390 = ".ERROR," + NL + "\t\t\t\t\t\t DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t 0," + NL + "\t\t\t\t\t\t ";
408   protected final String JavaDoc TEXT_391 = ".INSTANCE.getString(\"_UI_GenericConstraint_diagnostic\", new Object[] { \"";
409   protected final String JavaDoc TEXT_392 = "\", getValueLabel(";
410   protected final String JavaDoc TEXT_393 = ".eINSTANCE.get";
411   protected final String JavaDoc TEXT_394 = "(), ";
412   protected final String JavaDoc TEXT_395 = ", ";
413   protected final String JavaDoc TEXT_396 = ") }),";
414   protected final String JavaDoc TEXT_397 = NL + "\t\t\t\t\t\t new Object[] { ";
415   protected final String JavaDoc TEXT_398 = " }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn ";
416   protected final String JavaDoc TEXT_399 = "validate";
417   protected final String JavaDoc TEXT_400 = "_";
418   protected final String JavaDoc TEXT_401 = "(";
419   protected final String JavaDoc TEXT_402 = ", ";
420   protected final String JavaDoc TEXT_403 = ", ";
421   protected final String JavaDoc TEXT_404 = ");";
422   protected final String JavaDoc TEXT_405 = NL + "\t\t// TODO implement the constraint" + NL + "\t\t// -> specify the condition that violates the constraint" + NL + "\t\t// -> verify the diagnostic details, including severity, code, and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif (";
423   protected final String JavaDoc TEXT_406 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t";
424   protected final String JavaDoc TEXT_407 = ".add" + NL + "\t\t\t\t\t(new ";
425   protected final String JavaDoc TEXT_408 = NL + "\t\t\t\t\t\t(";
426   protected final String JavaDoc TEXT_409 = ".ERROR," + NL + "\t\t\t\t\t\t DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t 0," + NL + "\t\t\t\t\t\t ";
427   protected final String JavaDoc TEXT_410 = ".INSTANCE.getString(\"_UI_GenericConstraint_diagnostic\", new Object[] { \"";
428   protected final String JavaDoc TEXT_411 = "\", getValueLabel(";
429   protected final String JavaDoc TEXT_412 = ".eINSTANCE.get";
430   protected final String JavaDoc TEXT_413 = "(), ";
431   protected final String JavaDoc TEXT_414 = ", ";
432   protected final String JavaDoc TEXT_415 = ") }),";
433   protected final String JavaDoc TEXT_416 = NL + "\t\t\t\t\t\t new Object[] { ";
434   protected final String JavaDoc TEXT_417 = " }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;";
435   protected final String JavaDoc TEXT_418 = NL + "\t\t// TODO override the constraint, if desired" + NL + "\t\t// -> uncomment the scaffolding" + NL + "\t\t// -> specify the condition that violates the constraint" + NL + "\t\t// -> verify the diagnostic details, including severity, code, and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif (";
436   protected final String JavaDoc TEXT_419 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t";
437   protected final String JavaDoc TEXT_420 = ".add" + NL + "\t\t\t\t\t(new ";
438   protected final String JavaDoc TEXT_421 = NL + "\t\t\t\t\t\t(";
439   protected final String JavaDoc TEXT_422 = ".ERROR," + NL + "\t\t\t\t\t\t DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t 0," + NL + "\t\t\t\t\t\t ";
440   protected final String JavaDoc TEXT_423 = ".INSTANCE.getString(\"_UI_GenericConstraint_diagnostic\", new Object[] { \"";
441   protected final String JavaDoc TEXT_424 = "\", getObjectLabel(";
442   protected final String JavaDoc TEXT_425 = ", ";
443   protected final String JavaDoc TEXT_426 = ") }),";
444   protected final String JavaDoc TEXT_427 = NL + "\t\t\t\t\t\t new Object[] { ";
445   protected final String JavaDoc TEXT_428 = " }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn ";
446   protected final String JavaDoc TEXT_429 = "validate";
447   protected final String JavaDoc TEXT_430 = "_";
448   protected final String JavaDoc TEXT_431 = "(";
449   protected final String JavaDoc TEXT_432 = ", ";
450   protected final String JavaDoc TEXT_433 = ", ";
451   protected final String JavaDoc TEXT_434 = ");";
452   protected final String JavaDoc TEXT_435 = NL + "\t\treturn ";
453   protected final String JavaDoc TEXT_436 = ".";
454   protected final String JavaDoc TEXT_437 = "(";
455   protected final String JavaDoc TEXT_438 = ", ";
456   protected final String JavaDoc TEXT_439 = ");";
457   protected final String JavaDoc TEXT_440 = NL + "\t\t// TODO implement the constraint" + NL + "\t\t// -> specify the condition that violates the constraint" + NL + "\t\t// -> verify the diagnostic details, including severity, code, and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif (";
458   protected final String JavaDoc TEXT_441 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t";
459   protected final String JavaDoc TEXT_442 = ".add" + NL + "\t\t\t\t\t(new ";
460   protected final String JavaDoc TEXT_443 = NL + "\t\t\t\t\t\t(";
461   protected final String JavaDoc TEXT_444 = ".ERROR," + NL + "\t\t\t\t\t\t DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t 0," + NL + "\t\t\t\t\t\t ";
462   protected final String JavaDoc TEXT_445 = ".INSTANCE.getString(\"_UI_GenericConstraint_diagnostic\", new Object[] { \"";
463   protected final String JavaDoc TEXT_446 = "\", getObjectLabel(";
464   protected final String JavaDoc TEXT_447 = ", ";
465   protected final String JavaDoc TEXT_448 = ") }),";
466   protected final String JavaDoc TEXT_449 = NL + "\t\t\t\t\t\t new Object[] { ";
467   protected final String JavaDoc TEXT_450 = " }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;";
468   protected final String JavaDoc TEXT_451 = NL + "\t}" + NL;
469   protected final String JavaDoc TEXT_452 = NL + "} //";
470   protected final String JavaDoc TEXT_453 = NL;
471
472   public String JavaDoc generate(Object JavaDoc argument)
473   {
474     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
475     
476 /**
477  * <copyright>
478  *
479  * Copyright (c) 2002-2005 IBM Corporation and others.
480  * All rights reserved. This program and the accompanying materials
481  * are made available under the terms of the Eclipse Public License v1.0
482  * which accompanies this distribution, and is available at
483  * http://www.eclipse.org/legal/epl-v10.html
484  *
485  * Contributors:
486  * IBM - Initial API and implementation
487  *
488  * </copyright>
489  */

490
491     GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
492     stringBuffer.append(TEXT_1);
493     stringBuffer.append(TEXT_2);
494     stringBuffer.append("$");
495     stringBuffer.append(TEXT_3);
496     stringBuffer.append("$");
497     stringBuffer.append(TEXT_4);
498     stringBuffer.append(genPackage.getUtilitiesPackageName());
499     stringBuffer.append(TEXT_5);
500     genModel.addImport("java.util.Map");
501     genModel.addImport("org.eclipse.emf.common.util.DiagnosticChain");
502     genModel.addImport("org.eclipse.emf.ecore.EPackage");
503     if (!genPackage.hasJavaLangConflict() && !genPackage.getUtilitiesPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");
504     genModel.markImportLocation(stringBuffer);
505     genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.Registry");
506     genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider");
507     genModel.addPseudoImport("org.eclipse.emf.ecore.EValidator.PatternMatcher");
508     stringBuffer.append(TEXT_6);
509     stringBuffer.append(genPackage.getQualifiedPackageInterfaceName());
510     stringBuffer.append(TEXT_7);
511     stringBuffer.append(genPackage.getValidatorClassName());
512     stringBuffer.append(TEXT_8);
513     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator"));
514     stringBuffer.append(TEXT_9);
515     if (genModel.getCopyrightText() != null) {
516     stringBuffer.append(TEXT_10);
517     stringBuffer.append(genModel.getImportedName("java.lang.String"));
518     stringBuffer.append(TEXT_11);
519     stringBuffer.append(genModel.getCopyrightText());
520     stringBuffer.append(TEXT_12);
521     stringBuffer.append(genModel.getNonNLS());
522     stringBuffer.append(TEXT_13);
523     }
524     stringBuffer.append(TEXT_14);
525     stringBuffer.append(genPackage.getValidatorClassName());
526     stringBuffer.append(TEXT_15);
527     stringBuffer.append(genPackage.getValidatorClassName());
528     stringBuffer.append(TEXT_16);
529     stringBuffer.append(genPackage.getInterfacePackageName());
530     stringBuffer.append(TEXT_17);
531     stringBuffer.append(genModel.getNonNLS());
532     stringBuffer.append(TEXT_18);
533     int count = 0; for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();
534     for (Iterator j=genClass.getGenOperations().iterator(); j.hasNext();) { GenOperation genOperation = (GenOperation)j.next();
535     if (genOperation.isInvariant()) {
536     stringBuffer.append(TEXT_19);
537     stringBuffer.append(genClass.format(genOperation.getName(), ' ', null, true));
538     stringBuffer.append(TEXT_20);
539     stringBuffer.append(genClass.getFormattedName());
540     stringBuffer.append(TEXT_21);
541     stringBuffer.append(genClass.getOperationID(genOperation));
542     stringBuffer.append(TEXT_22);
543     stringBuffer.append(++count);
544     stringBuffer.append(TEXT_23);
545     }}}
546     stringBuffer.append(TEXT_24);
547     stringBuffer.append(count);
548     stringBuffer.append(TEXT_25);
549     for (Iterator i = genPackage.getAllValidatorBaseGenPackages().iterator(); i.hasNext(); ) { GenPackage baseGenPackage = (GenPackage)i.next();
550     stringBuffer.append(TEXT_26);
551     stringBuffer.append(baseGenPackage.getImportedValidatorClassName());
552     stringBuffer.append(TEXT_27);
553     stringBuffer.append(genPackage.getValidatorPackageUniqueSafeName(baseGenPackage));
554     stringBuffer.append(TEXT_28);
555     }
556     stringBuffer.append(TEXT_29);
557     stringBuffer.append(genPackage.getValidatorClassName());
558     stringBuffer.append(TEXT_30);
559     for (Iterator i = genPackage.getAllValidatorBaseGenPackages().iterator(); i.hasNext(); ) { GenPackage baseGenPackage = (GenPackage)i.next();
560     stringBuffer.append(TEXT_31);
561     stringBuffer.append(genPackage.getValidatorPackageUniqueSafeName(baseGenPackage));
562     stringBuffer.append(TEXT_32);
563     stringBuffer.append(baseGenPackage.getImportedValidatorClassName());
564     stringBuffer.append(TEXT_33);
565     }
566     stringBuffer.append(TEXT_34);
567     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
568     stringBuffer.append(TEXT_35);
569     for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next();
570     stringBuffer.append(TEXT_36);
571     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
572     stringBuffer.append(TEXT_37);
573     stringBuffer.append(genPackage.getClassifierID(genClassifier));
574     stringBuffer.append(TEXT_38);
575     if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;
576     if (genDataType.isPrimitiveType()) {
577     stringBuffer.append(TEXT_39);
578     stringBuffer.append(genDataType.getName());
579     stringBuffer.append(TEXT_40);
580     stringBuffer.append(genDataType.getObjectInstanceClassName());
581     stringBuffer.append(TEXT_41);
582     stringBuffer.append(genDataType.getPrimitiveValueFunction());
583     stringBuffer.append(TEXT_42);
584     } else if (genDataType.isObjectType()) {
585     stringBuffer.append(TEXT_43);
586     stringBuffer.append(genDataType.getName());
587     stringBuffer.append(TEXT_44);
588     } else {
589     stringBuffer.append(TEXT_45);
590     stringBuffer.append(genDataType.getName());
591     stringBuffer.append(TEXT_46);
592     stringBuffer.append(genDataType.getImportedInstanceClassName());
593     stringBuffer.append(TEXT_47);
594     }
595     } else { GenClass genClass = (GenClass)genClassifier;
596     stringBuffer.append(TEXT_48);
597     stringBuffer.append(genClass.getName());
598     stringBuffer.append(TEXT_49);
599     stringBuffer.append(genClass.getImportedInterfaceName());
600     stringBuffer.append(TEXT_50);
601     }
602     }
603     stringBuffer.append(TEXT_51);
604     for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); String JavaDoc result = "result".equals(genClassifier.getSafeUncapName()) ? "theResult" : "result"; String JavaDoc diagnostics = "diagnostics".equals(genClassifier.getSafeUncapName()) ? "theDiagnostics" : "diagnostics"; String JavaDoc item = "item".equals(genClassifier.getSafeUncapName()) ? "theItem" : "item"; String JavaDoc context = "context".equals(genClassifier.getSafeUncapName()) ? "theContext" : "context";
605     stringBuffer.append(TEXT_52);
606     stringBuffer.append(genClassifier.getName());
607     stringBuffer.append(TEXT_53);
608     stringBuffer.append(genClassifier.getImportedInstanceClassName());
609     stringBuffer.append(TEXT_54);
610     stringBuffer.append(genClassifier.getSafeUncapName());
611     stringBuffer.append(TEXT_55);
612     stringBuffer.append(diagnostics);
613     stringBuffer.append(TEXT_56);
614     stringBuffer.append(context);
615     stringBuffer.append(TEXT_57);
616     if (genClassifier.getAllGenConstraints().isEmpty()) {
617     stringBuffer.append(TEXT_58);
618     } else if (genClassifier.hasOnlyDefaultConstraints()) {
619     stringBuffer.append(TEXT_59);
620     if (!((GenClass)genClassifier).isEObjectExtension()){
621     stringBuffer.append(TEXT_60);
622     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EObject"));
623     stringBuffer.append(TEXT_61);
624     }
625     stringBuffer.append(genClassifier.getSafeUncapName());
626     stringBuffer.append(TEXT_62);
627     stringBuffer.append(diagnostics);
628     stringBuffer.append(TEXT_63);
629     stringBuffer.append(context);
630     stringBuffer.append(TEXT_64);
631     } else { boolean first = true;
632     for (Iterator j=genClassifier.getAllGenConstraints().iterator(); j.hasNext(); ) { String JavaDoc constraint = (String JavaDoc)j.next();
633   GenClassifier constraintImplementor = genClassifier.getConstraintImplementor(constraint);
634   String JavaDoc delegate = constraintImplementor == null || constraintImplementor.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(constraintImplementor.getGenPackage()) + "Validator.";
635   String JavaDoc cast = constraintImplementor == null && genClassifier instanceof GenClass && !((GenClass)genClassifier).isEObjectExtension() ? "(" + genModel.getImportedName("org.eclipse.emf.ecore.EObject") + ")" : "";
636   String JavaDoc accessor = constraintImplementor != null && genClassifier instanceof GenDataType && !((GenDataType)genClassifier).isPrimitiveType() && ((GenDataType)constraintImplementor).isPrimitiveType() ? "." + ((GenDataType)constraintImplementor).getPrimitiveValueFunction() + "()" : "";
637     if (first) { first = false;
638     stringBuffer.append(TEXT_65);
639     stringBuffer.append(result);
640     stringBuffer.append(TEXT_66);
641     stringBuffer.append(delegate);
642     stringBuffer.append(TEXT_67);
643     stringBuffer.append(constraintImplementor == null ? "" : constraintImplementor.getName());
644     stringBuffer.append(TEXT_68);
645     stringBuffer.append(constraint);
646     stringBuffer.append(TEXT_69);
647     stringBuffer.append(cast);
648     stringBuffer.append(genClassifier.getSafeUncapName());
649     stringBuffer.append(accessor);
650     stringBuffer.append(TEXT_70);
651     stringBuffer.append(diagnostics);
652     stringBuffer.append(TEXT_71);
653     stringBuffer.append(context);
654     stringBuffer.append(TEXT_72);
655     } else {
656     stringBuffer.append(TEXT_73);
657     stringBuffer.append(result);
658     stringBuffer.append(TEXT_74);
659     stringBuffer.append(diagnostics);
660     stringBuffer.append(TEXT_75);
661     stringBuffer.append(delegate);
662     stringBuffer.append(TEXT_76);
663     stringBuffer.append(constraintImplementor == null ? "" : constraintImplementor.getName());
664     stringBuffer.append(TEXT_77);
665     stringBuffer.append(constraint);
666     stringBuffer.append(TEXT_78);
667     stringBuffer.append(cast);
668     stringBuffer.append(genClassifier.getSafeUncapName());
669     stringBuffer.append(accessor);
670     stringBuffer.append(TEXT_79);
671     stringBuffer.append(diagnostics);
672     stringBuffer.append(TEXT_80);
673     stringBuffer.append(context);
674     stringBuffer.append(TEXT_81);
675     }
676     }
677     stringBuffer.append(TEXT_82);
678     stringBuffer.append(result);
679     stringBuffer.append(TEXT_83);
680     }
681     stringBuffer.append(TEXT_84);
682     for (Iterator j=genClassifier.getGenConstraints().iterator(); j.hasNext();)
683 { String JavaDoc constraint = (String JavaDoc)j.next();
684   GenClassifier constraintDelegate = genClassifier.getConstraintDelegate(constraint);
685   String JavaDoc constant = genClassifier.getClassifierID() + "__" + genClassifier.format(constraint, '_', null, false).toUpperCase();
686   String JavaDoc delegate = constraintDelegate == null || constraintDelegate.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(constraintDelegate.getGenPackage()) + "Validator.";
687   String JavaDoc cast = constraintDelegate == null && genClassifier instanceof GenClass && !((GenClass)genClassifier).isEObjectExtension() ? "(" + genModel.getImportedName("org.eclipse.emf.ecore.EObject") + ")" : "";
688   String JavaDoc accessor = constraintDelegate != null && genClassifier instanceof GenDataType && !((GenDataType)genClassifier).isPrimitiveType() && ((GenDataType)constraintDelegate).isPrimitiveType() ? "." + ((GenDataType)constraintDelegate).getPrimitiveValueFunction() + "()" : "";
689     if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;
690     if (constraint.equals("Min") && genDataType.getMinLiteral() != null) {
691     stringBuffer.append(TEXT_85);
692     stringBuffer.append(genDataType.getName());
693     stringBuffer.append(TEXT_86);
694     stringBuffer.append(constraint);
695     stringBuffer.append(TEXT_87);
696     stringBuffer.append(genDataType.getImportedInstanceClassName());
697     stringBuffer.append(TEXT_88);
698     stringBuffer.append(constant);
699     stringBuffer.append(TEXT_89);
700     stringBuffer.append(genDataType.getStaticValue(genDataType.getMinLiteral()));
701     stringBuffer.append(TEXT_90);
702     } else if (constraint.equals("Max") && genDataType.getMaxLiteral() != null) {
703     stringBuffer.append(TEXT_91);
704     stringBuffer.append(genDataType.getName());
705     stringBuffer.append(TEXT_92);
706     stringBuffer.append(constraint);
707     stringBuffer.append(TEXT_93);
708     stringBuffer.append(genDataType.getImportedInstanceClassName());
709     stringBuffer.append(TEXT_94);
710     stringBuffer.append(constant);
711     stringBuffer.append(TEXT_95);
712     stringBuffer.append(genDataType.getStaticValue(genDataType.getMaxLiteral()));
713     stringBuffer.append(TEXT_96);
714     } else if (constraint.equals("TotalDigits") && genDataType.getTotalDigits() != -1 && !"java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) { String JavaDoc value = "1"; for (int digitCount = genDataType.getTotalDigits(); digitCount > 0; --digitCount) value += "0";
715     stringBuffer.append(TEXT_97);
716     stringBuffer.append(genDataType.getName());
717     stringBuffer.append(TEXT_98);
718     stringBuffer.append(constraint);
719     stringBuffer.append(TEXT_99);
720     stringBuffer.append(genDataType.getImportedInstanceClassName());
721     stringBuffer.append(TEXT_100);
722     stringBuffer.append(constant);
723     stringBuffer.append(TEXT_101);
724     stringBuffer.append(genDataType.getStaticValue(value));
725     stringBuffer.append(TEXT_102);
726     stringBuffer.append(genDataType.getName());
727     stringBuffer.append(TEXT_103);
728     stringBuffer.append(constraint);
729     stringBuffer.append(TEXT_104);
730     stringBuffer.append(genDataType.getImportedInstanceClassName());
731     stringBuffer.append(TEXT_105);
732     stringBuffer.append(constant);
733     stringBuffer.append(TEXT_106);
734     stringBuffer.append(genDataType.getStaticValue("-" + value));
735     stringBuffer.append(TEXT_107);
736     } else if (constraint.equals("Pattern") && !genDataType.getPatterns().isEmpty()) {
737     stringBuffer.append(TEXT_108);
738     stringBuffer.append(genDataType.getName());
739     stringBuffer.append(TEXT_109);
740     stringBuffer.append(constraint);
741     stringBuffer.append(TEXT_110);
742     stringBuffer.append(constant);
743     stringBuffer.append(TEXT_111);
744     for (Iterator k = genDataType.getPatterns().iterator(); k.hasNext(); ) { List patternList = (List)k.next();
745     stringBuffer.append(TEXT_112);
746     for (Iterator p = patternList.iterator(); p.hasNext(); ) { String JavaDoc pattern = (String JavaDoc)p.next();
747     stringBuffer.append(TEXT_113);
748     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil"));
749     stringBuffer.append(TEXT_114);
750     stringBuffer.append(pattern);
751     stringBuffer.append(TEXT_115);
752     stringBuffer.append(p.hasNext() ? "," : "");
753     }
754     stringBuffer.append(TEXT_116);
755     stringBuffer.append(k.hasNext() ? "," : "");
756     }
757     stringBuffer.append(TEXT_117);
758     } else if (constraint.equals("Enumeration") && !genDataType.getEnumerationLiterals().isEmpty()) {
759     stringBuffer.append(TEXT_118);
760     stringBuffer.append(genDataType.getName());
761     stringBuffer.append(TEXT_119);
762     stringBuffer.append(constraint);
763     stringBuffer.append(TEXT_120);
764     stringBuffer.append(genModel.getImportedName("java.util.Collection"));
765     stringBuffer.append(TEXT_121);
766     stringBuffer.append(constant);
767     stringBuffer.append(TEXT_122);
768     for (Iterator k = genDataType.getEnumerationLiterals().iterator(); k.hasNext(); ) { String JavaDoc literal = (String JavaDoc)k.next();
769     stringBuffer.append(TEXT_123);
770     if (genDataType.isPrimitiveType()) {
771     stringBuffer.append(TEXT_124);
772     stringBuffer.append(genDataType.getObjectInstanceClassName());
773     stringBuffer.append(TEXT_125);
774     }
775     stringBuffer.append(genDataType.getStaticValue(literal));
776     if (genDataType.isPrimitiveType()) {
777     stringBuffer.append(TEXT_126);
778     }
779     stringBuffer.append(k.hasNext() ? "," : "");
780     }
781     stringBuffer.append(TEXT_127);
782     }
783     }
784     stringBuffer.append(TEXT_128);
785     stringBuffer.append(constraint);
786     stringBuffer.append(TEXT_129);
787     stringBuffer.append(genClassifier.getFormattedName());
788     stringBuffer.append(TEXT_130);
789     stringBuffer.append(genClassifier.getName());
790     stringBuffer.append(TEXT_131);
791     stringBuffer.append(constraint);
792     stringBuffer.append(TEXT_132);
793     stringBuffer.append(genClassifier.getImportedInstanceClassName());
794     stringBuffer.append(TEXT_133);
795     stringBuffer.append(genClassifier.getSafeUncapName());
796     stringBuffer.append(TEXT_134);
797     stringBuffer.append(diagnostics);
798     stringBuffer.append(TEXT_135);
799     stringBuffer.append(context);
800     stringBuffer.append(TEXT_136);
801     if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;
802     if (constraint.equals("ItemType") && genDataType.getItemType() != null) { GenDataType itemType = genDataType.getItemType(); String JavaDoc itemDelegate = itemType.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(itemType.getGenPackage()) + "Validator.";
803     stringBuffer.append(TEXT_137);
804     stringBuffer.append(result);
805     stringBuffer.append(TEXT_138);
806     stringBuffer.append(genModel.getImportedName("java.util.Iterator"));
807     stringBuffer.append(TEXT_139);
808     stringBuffer.append(genClassifier.getSafeUncapName());
809     stringBuffer.append(TEXT_140);
810     stringBuffer.append(itemType.getGenPackage().getImportedPackageInterfaceName());
811     stringBuffer.append(TEXT_141);
812     stringBuffer.append(itemType.getClassifierAccessorName());
813     stringBuffer.append(TEXT_142);
814     stringBuffer.append(itemDelegate);
815     stringBuffer.append(TEXT_143);
816     stringBuffer.append(itemType.getName());
817     stringBuffer.append(TEXT_144);
818     if (itemType.isPrimitiveType()) {
819     stringBuffer.append(TEXT_145);
820     }
821     stringBuffer.append(TEXT_146);
822     stringBuffer.append(itemType.getObjectInstanceClassName());
823     stringBuffer.append(TEXT_147);
824     stringBuffer.append(item);
825     if (itemType.isPrimitiveType()) {
826     stringBuffer.append(TEXT_148);
827     stringBuffer.append(itemType.getPrimitiveValueFunction());
828     stringBuffer.append(TEXT_149);
829     }
830     stringBuffer.append(TEXT_150);
831     stringBuffer.append(diagnostics);
832     stringBuffer.append(TEXT_151);
833     stringBuffer.append(context);
834     stringBuffer.append(TEXT_152);
835     stringBuffer.append(itemType.getGenPackage().getImportedPackageInterfaceName());
836     stringBuffer.append(TEXT_153);
837     stringBuffer.append(itemType.getClassifierAccessorName());
838     stringBuffer.append(TEXT_154);
839     stringBuffer.append(diagnostics);
840     stringBuffer.append(TEXT_155);
841     stringBuffer.append(context);
842     stringBuffer.append(TEXT_156);
843     } else if (constraint.equals("MemberTypes") && !genDataType.getMemberTypes().isEmpty()) {
844     stringBuffer.append(TEXT_157);
845     stringBuffer.append(result);
846     stringBuffer.append(TEXT_158);
847     for (ListIterator k = genDataType.getMemberTypes().listIterator(); k.hasNext(); ) { GenDataType memberType = (GenDataType)k.next(); String JavaDoc memberDelegate = memberType.getGenPackage() == genPackage ? "" : genPackage.getValidatorPackageUniqueSafeName(memberType.getGenPackage()) + "Validator.";
848     stringBuffer.append(TEXT_159);
849     if (k.previousIndex() != 0){
850     stringBuffer.append(TEXT_160);
851     }
852     stringBuffer.append(TEXT_161);
853     stringBuffer.append(memberType.getGenPackage().getImportedPackageInterfaceName());
854     stringBuffer.append(TEXT_162);
855     stringBuffer.append(memberType.getClassifierAccessorName());
856     stringBuffer.append(TEXT_163);
857     stringBuffer.append(genClassifier.getSafeUncapName());
858     stringBuffer.append(TEXT_164);
859     stringBuffer.append(memberDelegate);
860     stringBuffer.append(TEXT_165);
861     stringBuffer.append(memberType.getName());
862     stringBuffer.append(TEXT_166);
863     if (memberType.isPrimitiveType()) {
864     stringBuffer.append(TEXT_167);
865     }
866     stringBuffer.append(TEXT_168);
867     stringBuffer.append(memberType.getObjectInstanceClassName());
868     stringBuffer.append(TEXT_169);
869     stringBuffer.append(genClassifier.getSafeUncapName());
870     if (memberType.isPrimitiveType()) {
871     stringBuffer.append(TEXT_170);
872     stringBuffer.append(memberType.getPrimitiveValueFunction());
873     stringBuffer.append(TEXT_171);
874     }
875     stringBuffer.append(TEXT_172);
876     stringBuffer.append(diagnostics);
877     stringBuffer.append(TEXT_173);
878     stringBuffer.append(context);
879     stringBuffer.append(TEXT_174);
880     }
881     stringBuffer.append(TEXT_175);
882     } else if (constraint.equals("Pattern") && !genDataType.getPatterns().isEmpty()) {
883     stringBuffer.append(TEXT_176);
884     stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
885     stringBuffer.append(TEXT_177);
886     stringBuffer.append(genDataType.getClassifierAccessorName());
887     stringBuffer.append(TEXT_178);
888     if (genDataType.isPrimitiveType()) {
889     stringBuffer.append(TEXT_179);
890     stringBuffer.append(genDataType.getObjectInstanceClassName());
891     stringBuffer.append(TEXT_180);
892     }
893     stringBuffer.append(genDataType.getSafeUncapName());
894     if (genDataType.isPrimitiveType()) {
895     stringBuffer.append(TEXT_181);
896     }
897     stringBuffer.append(TEXT_182);
898     stringBuffer.append(constant);
899     stringBuffer.append(TEXT_183);
900     stringBuffer.append(diagnostics);
901     stringBuffer.append(TEXT_184);
902     stringBuffer.append(context);
903     stringBuffer.append(TEXT_185);
904     } else if (constraint.equals("Enumeration") && !genDataType.getEnumerationLiterals().isEmpty()) { String JavaDoc variable = genDataType.getSafeUncapName();
905     if (genDataType.isPrimitiveType()) { variable = variable + "Object";
906     stringBuffer.append(TEXT_186);
907     stringBuffer.append(genDataType.getObjectInstanceClassName());
908     stringBuffer.append(TEXT_187);
909     stringBuffer.append(variable);
910     stringBuffer.append(TEXT_188);
911     stringBuffer.append(genDataType.getObjectInstanceClassName());
912     stringBuffer.append(TEXT_189);
913     stringBuffer.append(genDataType.getSafeUncapName());
914     stringBuffer.append(TEXT_190);
915     }
916     stringBuffer.append(TEXT_191);
917     stringBuffer.append(result);
918     stringBuffer.append(TEXT_192);
919     stringBuffer.append(constant);
920     stringBuffer.append(TEXT_193);
921     stringBuffer.append(variable);
922     stringBuffer.append(TEXT_194);
923     stringBuffer.append(result);
924     stringBuffer.append(TEXT_195);
925     stringBuffer.append(diagnostics);
926     stringBuffer.append(TEXT_196);
927     stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
928     stringBuffer.append(TEXT_197);
929     stringBuffer.append(genDataType.getClassifierAccessorName());
930     stringBuffer.append(TEXT_198);
931     stringBuffer.append(variable);
932     stringBuffer.append(TEXT_199);
933     stringBuffer.append(constant);
934     stringBuffer.append(TEXT_200);
935     stringBuffer.append(diagnostics);
936     stringBuffer.append(TEXT_201);
937     stringBuffer.append(context);
938     stringBuffer.append(TEXT_202);
939     stringBuffer.append(result);
940     stringBuffer.append(TEXT_203);
941     } else if (constraint.equals("Min") && genDataType.getMinLiteral() != null) {
942     if (genDataType.isPrimitiveType()) {
943     stringBuffer.append(TEXT_204);
944     stringBuffer.append(result);
945     stringBuffer.append(TEXT_205);
946     stringBuffer.append(genDataType.getSafeUncapName());
947     stringBuffer.append(TEXT_206);
948     stringBuffer.append(genDataType.isMinInclusive() ? ">=" : ">");
949     stringBuffer.append(TEXT_207);
950     stringBuffer.append(constant);
951     stringBuffer.append(TEXT_208);
952     stringBuffer.append(result);
953     stringBuffer.append(TEXT_209);
954     stringBuffer.append(diagnostics);
955     stringBuffer.append(TEXT_210);
956     stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
957     stringBuffer.append(TEXT_211);
958     stringBuffer.append(genDataType.getClassifierAccessorName());
959     stringBuffer.append(TEXT_212);
960     stringBuffer.append(genDataType.getObjectInstanceClassName());
961     stringBuffer.append(TEXT_213);
962     stringBuffer.append(genDataType.getSafeUncapName());
963     stringBuffer.append(TEXT_214);
964     stringBuffer.append(genDataType.getObjectInstanceClassName());
965     stringBuffer.append(TEXT_215);
966     stringBuffer.append(constant);
967     stringBuffer.append(TEXT_216);
968     stringBuffer.append(genDataType.isMinInclusive() ? "true" : "false");
969     stringBuffer.append(TEXT_217);
970     stringBuffer.append(diagnostics);
971     stringBuffer.append(TEXT_218);
972     stringBuffer.append(context);
973     stringBuffer.append(TEXT_219);
974     stringBuffer.append(result);
975     stringBuffer.append(TEXT_220);
976     } else { String JavaDoc comparison = "comparison".equals(genClassifier.getSafeUncapName()) ? "theComparison" : "comparison";
977     if (genDataType.isXMLCalendar()) {
978     stringBuffer.append(TEXT_221);
979     stringBuffer.append(comparison);
980     stringBuffer.append(TEXT_222);
981     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil"));
982     stringBuffer.append(TEXT_223);
983     stringBuffer.append(genDataType.getSafeUncapName());
984     stringBuffer.append(TEXT_224);
985     stringBuffer.append(constant);
986     stringBuffer.append(TEXT_225);
987     stringBuffer.append(result);
988     stringBuffer.append(TEXT_226);
989     if (genDataType.isMinInclusive()) {
990     stringBuffer.append(comparison);
991     stringBuffer.append(TEXT_227);
992     }
993     stringBuffer.append(comparison);
994     stringBuffer.append(TEXT_228);
995     } else if (genDataType.isXMLDuration()) {
996     stringBuffer.append(TEXT_229);
997     stringBuffer.append(comparison);
998     stringBuffer.append(TEXT_230);
999     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil"));
1000    stringBuffer.append(TEXT_231);
1001    stringBuffer.append(genDataType.getSafeUncapName());
1002    stringBuffer.append(TEXT_232);
1003    stringBuffer.append(constant);
1004    stringBuffer.append(TEXT_233);
1005    stringBuffer.append(result);
1006    stringBuffer.append(TEXT_234);
1007    if (genDataType.isMinInclusive()) {
1008    stringBuffer.append(comparison);
1009    stringBuffer.append(TEXT_235);
1010    }
1011    stringBuffer.append(comparison);
1012    stringBuffer.append(TEXT_236);
1013    } else {
1014    stringBuffer.append(TEXT_237);
1015    stringBuffer.append(result);
1016    stringBuffer.append(TEXT_238);
1017    stringBuffer.append(genDataType.getSafeUncapName());
1018    stringBuffer.append(TEXT_239);
1019    stringBuffer.append(constant);
1020    stringBuffer.append(TEXT_240);
1021    stringBuffer.append(genDataType.isMinInclusive() ? ">=" : ">");
1022    stringBuffer.append(TEXT_241);
1023    }
1024    stringBuffer.append(TEXT_242);
1025    stringBuffer.append(result);
1026    stringBuffer.append(TEXT_243);
1027    stringBuffer.append(diagnostics);
1028    stringBuffer.append(TEXT_244);
1029    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1030    stringBuffer.append(TEXT_245);
1031    stringBuffer.append(genDataType.getClassifierAccessorName());
1032    stringBuffer.append(TEXT_246);
1033    stringBuffer.append(genDataType.getSafeUncapName());
1034    stringBuffer.append(TEXT_247);
1035    stringBuffer.append(constant);
1036    stringBuffer.append(TEXT_248);
1037    stringBuffer.append(genDataType.isMinInclusive() ? "true" : "false");
1038    stringBuffer.append(TEXT_249);
1039    stringBuffer.append(diagnostics);
1040    stringBuffer.append(TEXT_250);
1041    stringBuffer.append(context);
1042    stringBuffer.append(TEXT_251);
1043    stringBuffer.append(result);
1044    stringBuffer.append(TEXT_252);
1045    }
1046    } else if (constraint.equals("Max") && genDataType.getMaxLiteral() != null) {
1047    if (genDataType.isPrimitiveType()) {
1048    stringBuffer.append(TEXT_253);
1049    stringBuffer.append(result);
1050    stringBuffer.append(TEXT_254);
1051    stringBuffer.append(genDataType.getSafeUncapName());
1052    stringBuffer.append(TEXT_255);
1053    stringBuffer.append(genDataType.isMaxInclusive() ? "<=" : "<");
1054    stringBuffer.append(TEXT_256);
1055    stringBuffer.append(constant);
1056    stringBuffer.append(TEXT_257);
1057    stringBuffer.append(result);
1058    stringBuffer.append(TEXT_258);
1059    stringBuffer.append(diagnostics);
1060    stringBuffer.append(TEXT_259);
1061    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1062    stringBuffer.append(TEXT_260);
1063    stringBuffer.append(genDataType.getClassifierAccessorName());
1064    stringBuffer.append(TEXT_261);
1065    stringBuffer.append(genDataType.getObjectInstanceClassName());
1066    stringBuffer.append(TEXT_262);
1067    stringBuffer.append(genDataType.getSafeUncapName());
1068    stringBuffer.append(TEXT_263);
1069    stringBuffer.append(genDataType.getObjectInstanceClassName());
1070    stringBuffer.append(TEXT_264);
1071    stringBuffer.append(constant);
1072    stringBuffer.append(TEXT_265);
1073    stringBuffer.append(genDataType.isMaxInclusive() ? "true" : "false");
1074    stringBuffer.append(TEXT_266);
1075    stringBuffer.append(diagnostics);
1076    stringBuffer.append(TEXT_267);
1077    stringBuffer.append(context);
1078    stringBuffer.append(TEXT_268);
1079    stringBuffer.append(result);
1080    stringBuffer.append(TEXT_269);
1081    } else { String JavaDoc comparison = "comparison".equals(genClassifier.getSafeUncapName()) ? "theComparison" : "comparison";
1082    if (genDataType.isXMLCalendar()) {
1083    stringBuffer.append(TEXT_270);
1084    stringBuffer.append(comparison);
1085    stringBuffer.append(TEXT_271);
1086    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil"));
1087    stringBuffer.append(TEXT_272);
1088    stringBuffer.append(genDataType.getSafeUncapName());
1089    stringBuffer.append(TEXT_273);
1090    stringBuffer.append(constant);
1091    stringBuffer.append(TEXT_274);
1092    stringBuffer.append(result);
1093    stringBuffer.append(TEXT_275);
1094    if (genDataType.isMaxInclusive()) {
1095    stringBuffer.append(comparison);
1096    stringBuffer.append(TEXT_276);
1097    }
1098    stringBuffer.append(comparison);
1099    stringBuffer.append(TEXT_277);
1100    } else if (genDataType.isXMLDuration()) {
1101    stringBuffer.append(TEXT_278);
1102    stringBuffer.append(comparison);
1103    stringBuffer.append(TEXT_279);
1104    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil"));
1105    stringBuffer.append(TEXT_280);
1106    stringBuffer.append(genDataType.getSafeUncapName());
1107    stringBuffer.append(TEXT_281);
1108    stringBuffer.append(constant);
1109    stringBuffer.append(TEXT_282);
1110    stringBuffer.append(result);
1111    stringBuffer.append(TEXT_283);
1112    if (genDataType.isMaxInclusive()) {
1113    stringBuffer.append(comparison);
1114    stringBuffer.append(TEXT_284);
1115    }
1116    stringBuffer.append(comparison);
1117    stringBuffer.append(TEXT_285);
1118    } else {
1119    stringBuffer.append(TEXT_286);
1120    stringBuffer.append(result);
1121    stringBuffer.append(TEXT_287);
1122    stringBuffer.append(genDataType.getSafeUncapName());
1123    stringBuffer.append(TEXT_288);
1124    stringBuffer.append(constant);
1125    stringBuffer.append(TEXT_289);
1126    stringBuffer.append(genDataType.isMaxInclusive() ? "<=" : "<");
1127    stringBuffer.append(TEXT_290);
1128    }
1129    stringBuffer.append(TEXT_291);
1130    stringBuffer.append(result);
1131    stringBuffer.append(TEXT_292);
1132    stringBuffer.append(diagnostics);
1133    stringBuffer.append(TEXT_293);
1134    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1135    stringBuffer.append(TEXT_294);
1136    stringBuffer.append(genDataType.getClassifierAccessorName());
1137    stringBuffer.append(TEXT_295);
1138    stringBuffer.append(genDataType.getSafeUncapName());
1139    stringBuffer.append(TEXT_296);
1140    stringBuffer.append(constant);
1141    stringBuffer.append(TEXT_297);
1142    stringBuffer.append(genDataType.isMaxInclusive() ? "true" : "false");
1143    stringBuffer.append(TEXT_298);
1144    stringBuffer.append(diagnostics);
1145    stringBuffer.append(TEXT_299);
1146    stringBuffer.append(context);
1147    stringBuffer.append(TEXT_300);
1148    stringBuffer.append(result);
1149    stringBuffer.append(TEXT_301);
1150    }
1151    } else if (constraint.equals("MinLength") && genDataType.getMinLength() != -1) {
1152    stringBuffer.append(TEXT_302);
1153    stringBuffer.append(genDataType.getSafeUncapName());
1154    stringBuffer.append(TEXT_303);
1155    stringBuffer.append(genDataType.getLengthAccessorFunction());
1156    stringBuffer.append(TEXT_304);
1157    stringBuffer.append(result);
1158    stringBuffer.append(TEXT_305);
1159    stringBuffer.append(genDataType.getMinLength());
1160    stringBuffer.append(TEXT_306);
1161    stringBuffer.append(result);
1162    stringBuffer.append(TEXT_307);
1163    stringBuffer.append(diagnostics);
1164    stringBuffer.append(TEXT_308);
1165    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1166    stringBuffer.append(TEXT_309);
1167    stringBuffer.append(genDataType.getClassifierAccessorName());
1168    stringBuffer.append(TEXT_310);
1169    stringBuffer.append(genDataType.getSafeUncapName());
1170    stringBuffer.append(TEXT_311);
1171    stringBuffer.append(genDataType.getMinLength());
1172    stringBuffer.append(TEXT_312);
1173    stringBuffer.append(diagnostics);
1174    stringBuffer.append(TEXT_313);
1175    stringBuffer.append(context);
1176    stringBuffer.append(TEXT_314);
1177    stringBuffer.append(result);
1178    stringBuffer.append(TEXT_315);
1179    } else if (constraint.equals("MaxLength") && genDataType.getMaxLength() != -1) {
1180    stringBuffer.append(TEXT_316);
1181    stringBuffer.append(genDataType.getSafeUncapName());
1182    stringBuffer.append(TEXT_317);
1183    stringBuffer.append(genDataType.getLengthAccessorFunction());
1184    stringBuffer.append(TEXT_318);
1185    stringBuffer.append(result);
1186    stringBuffer.append(TEXT_319);
1187    stringBuffer.append(genDataType.getMaxLength());
1188    stringBuffer.append(TEXT_320);
1189    stringBuffer.append(result);
1190    stringBuffer.append(TEXT_321);
1191    stringBuffer.append(diagnostics);
1192    stringBuffer.append(TEXT_322);
1193    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1194    stringBuffer.append(TEXT_323);
1195    stringBuffer.append(genDataType.getClassifierAccessorName());
1196    stringBuffer.append(TEXT_324);
1197    stringBuffer.append(genDataType.getSafeUncapName());
1198    stringBuffer.append(TEXT_325);
1199    stringBuffer.append(genDataType.getMaxLength());
1200    stringBuffer.append(TEXT_326);
1201    stringBuffer.append(diagnostics);
1202    stringBuffer.append(TEXT_327);
1203    stringBuffer.append(context);
1204    stringBuffer.append(TEXT_328);
1205    stringBuffer.append(result);
1206    stringBuffer.append(TEXT_329);
1207    } else if (constraint.equals("TotalDigits") && genDataType.getTotalDigits() != -1) {
1208    if (genDataType.isPrimitiveType()) {
1209    stringBuffer.append(TEXT_330);
1210    stringBuffer.append(result);
1211    stringBuffer.append(TEXT_331);
1212    stringBuffer.append(genDataType.getSafeUncapName());
1213    stringBuffer.append(TEXT_332);
1214    stringBuffer.append(constant);
1215    stringBuffer.append(TEXT_333);
1216    stringBuffer.append(genDataType.getSafeUncapName());
1217    stringBuffer.append(TEXT_334);
1218    stringBuffer.append(constant);
1219    stringBuffer.append(TEXT_335);
1220    stringBuffer.append(result);
1221    stringBuffer.append(TEXT_336);
1222    stringBuffer.append(diagnostics);
1223    stringBuffer.append(TEXT_337);
1224    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1225    stringBuffer.append(TEXT_338);
1226    stringBuffer.append(genDataType.getClassifierAccessorName());
1227    stringBuffer.append(TEXT_339);
1228    stringBuffer.append(genDataType.getObjectInstanceClassName());
1229    stringBuffer.append(TEXT_340);
1230    stringBuffer.append(genDataType.getSafeUncapName());
1231    stringBuffer.append(TEXT_341);
1232    stringBuffer.append(genDataType.getTotalDigits());
1233    stringBuffer.append(TEXT_342);
1234    stringBuffer.append(diagnostics);
1235    stringBuffer.append(TEXT_343);
1236    stringBuffer.append(context);
1237    stringBuffer.append(TEXT_344);
1238    } else if ("java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) {
1239    stringBuffer.append(TEXT_345);
1240    stringBuffer.append(result);
1241    stringBuffer.append(TEXT_346);
1242    stringBuffer.append(genDataType.getSafeUncapName());
1243    stringBuffer.append(TEXT_347);
1244    stringBuffer.append(genDataType.getTotalDigits());
1245    stringBuffer.append(TEXT_348);
1246    stringBuffer.append(result);
1247    stringBuffer.append(TEXT_349);
1248    stringBuffer.append(diagnostics);
1249    stringBuffer.append(TEXT_350);
1250    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1251    stringBuffer.append(TEXT_351);
1252    stringBuffer.append(genDataType.getClassifierAccessorName());
1253    stringBuffer.append(TEXT_352);
1254    stringBuffer.append(genDataType.getSafeUncapName());
1255    stringBuffer.append(TEXT_353);
1256    stringBuffer.append(genDataType.getTotalDigits());
1257    stringBuffer.append(TEXT_354);
1258    stringBuffer.append(diagnostics);
1259    stringBuffer.append(TEXT_355);
1260    stringBuffer.append(context);
1261    stringBuffer.append(TEXT_356);
1262    } else {
1263    stringBuffer.append(TEXT_357);
1264    stringBuffer.append(result);
1265    stringBuffer.append(TEXT_358);
1266    stringBuffer.append(genDataType.getSafeUncapName());
1267    stringBuffer.append(TEXT_359);
1268    stringBuffer.append(constant);
1269    stringBuffer.append(TEXT_360);
1270    stringBuffer.append(genDataType.getSafeUncapName());
1271    stringBuffer.append(TEXT_361);
1272    stringBuffer.append(constant);
1273    stringBuffer.append(TEXT_362);
1274    stringBuffer.append(result);
1275    stringBuffer.append(TEXT_363);
1276    stringBuffer.append(diagnostics);
1277    stringBuffer.append(TEXT_364);
1278    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1279    stringBuffer.append(TEXT_365);
1280    stringBuffer.append(genDataType.getClassifierAccessorName());
1281    stringBuffer.append(TEXT_366);
1282    stringBuffer.append(genDataType.getSafeUncapName());
1283    stringBuffer.append(TEXT_367);
1284    stringBuffer.append(genDataType.getTotalDigits());
1285    stringBuffer.append(TEXT_368);
1286    stringBuffer.append(diagnostics);
1287    stringBuffer.append(TEXT_369);
1288    stringBuffer.append(context);
1289    stringBuffer.append(TEXT_370);
1290    }
1291    stringBuffer.append(TEXT_371);
1292    stringBuffer.append(result);
1293    stringBuffer.append(TEXT_372);
1294    } else if (constraint.equals("FractionDigits") && genDataType.getFractionDigits() != -1 && "java.math.BigDecimal".equals(genDataType.getQualifiedInstanceClassName())) {
1295    stringBuffer.append(TEXT_373);
1296    stringBuffer.append(result);
1297    stringBuffer.append(TEXT_374);
1298    stringBuffer.append(genDataType.getSafeUncapName());
1299    stringBuffer.append(TEXT_375);
1300    stringBuffer.append(genDataType.getFractionDigits());
1301    stringBuffer.append(TEXT_376);
1302    stringBuffer.append(result);
1303    stringBuffer.append(TEXT_377);
1304    stringBuffer.append(diagnostics);
1305    stringBuffer.append(TEXT_378);
1306    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1307    stringBuffer.append(TEXT_379);
1308    stringBuffer.append(genDataType.getClassifierAccessorName());
1309    stringBuffer.append(TEXT_380);
1310    stringBuffer.append(genDataType.getSafeUncapName());
1311    stringBuffer.append(TEXT_381);
1312    stringBuffer.append(genDataType.getFractionDigits());
1313    stringBuffer.append(TEXT_382);
1314    stringBuffer.append(diagnostics);
1315    stringBuffer.append(TEXT_383);
1316    stringBuffer.append(context);
1317    stringBuffer.append(TEXT_384);
1318    stringBuffer.append(result);
1319    stringBuffer.append(TEXT_385);
1320    } else if (constraintDelegate != null) {
1321    stringBuffer.append(TEXT_386);
1322    stringBuffer.append(diagnostics);
1323    stringBuffer.append(TEXT_387);
1324    stringBuffer.append(diagnostics);
1325    stringBuffer.append(TEXT_388);
1326    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic"));
1327    stringBuffer.append(TEXT_389);
1328    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic"));
1329    stringBuffer.append(TEXT_390);
1330    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin"));
1331    stringBuffer.append(TEXT_391);
1332    stringBuffer.append(constraint);
1333    stringBuffer.append(TEXT_392);
1334    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1335    stringBuffer.append(TEXT_393);
1336    stringBuffer.append(genDataType.getClassifierAccessorName());
1337    stringBuffer.append(TEXT_394);
1338    stringBuffer.append(genClassifier.getSafeUncapName());
1339    stringBuffer.append(TEXT_395);
1340    stringBuffer.append(context);
1341    stringBuffer.append(TEXT_396);
1342    stringBuffer.append(genModel.getNonNLS());
1343    stringBuffer.append(genModel.getNonNLS(2));
1344    stringBuffer.append(TEXT_397);
1345    stringBuffer.append(genClassifier.getSafeUncapName());
1346    stringBuffer.append(TEXT_398);
1347    stringBuffer.append(delegate);
1348    stringBuffer.append(TEXT_399);
1349    stringBuffer.append(constraintDelegate.getName());
1350    stringBuffer.append(TEXT_400);
1351    stringBuffer.append(constraint);
1352    stringBuffer.append(TEXT_401);
1353    stringBuffer.append(genClassifier.getSafeUncapName());
1354    stringBuffer.append(accessor);
1355    stringBuffer.append(TEXT_402);
1356    stringBuffer.append(diagnostics);
1357    stringBuffer.append(TEXT_403);
1358    stringBuffer.append(context);
1359    stringBuffer.append(TEXT_404);
1360    } else {
1361    stringBuffer.append(TEXT_405);
1362    stringBuffer.append(diagnostics);
1363    stringBuffer.append(TEXT_406);
1364    stringBuffer.append(diagnostics);
1365    stringBuffer.append(TEXT_407);
1366    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic"));
1367    stringBuffer.append(TEXT_408);
1368    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic"));
1369    stringBuffer.append(TEXT_409);
1370    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin"));
1371    stringBuffer.append(TEXT_410);
1372    stringBuffer.append(constraint);
1373    stringBuffer.append(TEXT_411);
1374    stringBuffer.append(genDataType.getGenPackage().getImportedPackageInterfaceName());
1375    stringBuffer.append(TEXT_412);
1376    stringBuffer.append(genDataType.getClassifierAccessorName());
1377    stringBuffer.append(TEXT_413);
1378    stringBuffer.append(genClassifier.getSafeUncapName());
1379    stringBuffer.append(TEXT_414);
1380    stringBuffer.append(context);
1381    stringBuffer.append(TEXT_415);
1382    stringBuffer.append(genModel.getNonNLS());
1383    stringBuffer.append(genModel.getNonNLS(2));
1384    stringBuffer.append(TEXT_416);
1385    stringBuffer.append(genClassifier.getSafeUncapName());
1386    stringBuffer.append(TEXT_417);
1387    }
1388    } else if (constraintDelegate != null) {
1389    stringBuffer.append(TEXT_418);
1390    stringBuffer.append(diagnostics);
1391    stringBuffer.append(TEXT_419);
1392    stringBuffer.append(diagnostics);
1393    stringBuffer.append(TEXT_420);
1394    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic"));
1395    stringBuffer.append(TEXT_421);
1396    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic"));
1397    stringBuffer.append(TEXT_422);
1398    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin"));
1399    stringBuffer.append(TEXT_423);
1400    stringBuffer.append(constraint);
1401    stringBuffer.append(TEXT_424);
1402    stringBuffer.append(genClassifier.getSafeUncapName());
1403    stringBuffer.append(TEXT_425);
1404    stringBuffer.append(context);
1405    stringBuffer.append(TEXT_426);
1406    stringBuffer.append(genModel.getNonNLS());
1407    stringBuffer.append(genModel.getNonNLS(2));
1408    stringBuffer.append(TEXT_427);
1409    stringBuffer.append(genClassifier.getSafeUncapName());
1410    stringBuffer.append(TEXT_428);
1411    stringBuffer.append(delegate);
1412    stringBuffer.append(TEXT_429);
1413    stringBuffer.append(constraintDelegate.getName());
1414    stringBuffer.append(TEXT_430);
1415    stringBuffer.append(constraint);
1416    stringBuffer.append(TEXT_431);
1417    stringBuffer.append(cast);
1418    stringBuffer.append(genClassifier.getSafeUncapName());
1419    stringBuffer.append(TEXT_432);
1420    stringBuffer.append(diagnostics);
1421    stringBuffer.append(TEXT_433);
1422    stringBuffer.append(context);
1423    stringBuffer.append(TEXT_434);
1424    } else { GenOperation genOperation = ((GenClass)genClassifier).getInvariantOperation(constraint); if (genOperation != null) {
1425    stringBuffer.append(TEXT_435);
1426    stringBuffer.append(genClassifier.getSafeUncapName());
1427    stringBuffer.append(TEXT_436);
1428    stringBuffer.append(constraint);
1429    stringBuffer.append(TEXT_437);
1430    stringBuffer.append(diagnostics);
1431    stringBuffer.append(TEXT_438);
1432    stringBuffer.append(context);
1433    stringBuffer.append(TEXT_439);
1434    } else {
1435    stringBuffer.append(TEXT_440);
1436    stringBuffer.append(diagnostics);
1437    stringBuffer.append(TEXT_441);
1438    stringBuffer.append(diagnostics);
1439    stringBuffer.append(TEXT_442);
1440    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic"));
1441    stringBuffer.append(TEXT_443);
1442    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic"));
1443    stringBuffer.append(TEXT_444);
1444    stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin"));
1445    stringBuffer.append(TEXT_445);
1446    stringBuffer.append(constraint);
1447    stringBuffer.append(TEXT_446);
1448    stringBuffer.append(genClassifier.getSafeUncapName());
1449    stringBuffer.append(TEXT_447);
1450    stringBuffer.append(context);
1451    stringBuffer.append(TEXT_448);
1452    stringBuffer.append(genModel.getNonNLS());
1453    stringBuffer.append(genModel.getNonNLS(2));
1454    stringBuffer.append(TEXT_449);
1455    stringBuffer.append(genClassifier.getSafeUncapName());
1456    stringBuffer.append(TEXT_450);
1457    }}
1458    stringBuffer.append(TEXT_451);
1459    }
1460    }
1461    stringBuffer.append(TEXT_452);
1462    stringBuffer.append(genPackage.getValidatorClassName());
1463    genModel.emitSortedImports();
1464    stringBuffer.append(TEXT_453);
1465    return stringBuffer.toString();
1466  }
1467}
1468
Popular Tags