KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.eclipse.emf.codegen.ecore.templates.model;
2
3 import java.util.*;
4 import org.eclipse.emf.ecore.*;
5 import org.eclipse.emf.codegen.ecore.genmodel.*;
6 import org.eclipse.emf.codegen.ecore.genmodel.impl.Literals;
7
8 public class PackageClass
9 {
10   protected static String JavaDoc nl;
11   public static synchronized PackageClass create(String JavaDoc lineSeparator)
12   {
13     nl = lineSeparator;
14     PackageClass result = new PackageClass();
15     nl = null;
16     return result;
17   }
18
19   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
20   protected final String JavaDoc TEXT_1 = "";
21   protected final String JavaDoc TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * ";
22   protected final String JavaDoc TEXT_3 = "Id";
23   protected final String JavaDoc TEXT_4 = NL + " */" + NL + "package ";
24   protected final String JavaDoc TEXT_5 = ";" + NL;
25   protected final String JavaDoc TEXT_6 = NL + NL + "/**" + NL + " * <!-- begin-user-doc -->" + NL + " * An implementation of the model <b>Package</b>." + NL + " * <!-- end-user-doc -->" + NL + " * @generated" + NL + " */" + NL + "public class ";
26   protected final String JavaDoc TEXT_7 = " extends ";
27   protected final String JavaDoc TEXT_8 = " implements ";
28   protected final String JavaDoc TEXT_9 = NL + "{";
29   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 ";
30   protected final String JavaDoc TEXT_11 = " copyright = \"";
31   protected final String JavaDoc TEXT_12 = "\";";
32   protected final String JavaDoc TEXT_13 = NL;
33   protected final String JavaDoc TEXT_14 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected String packageFilename = \"";
34   protected final String JavaDoc TEXT_15 = "\";";
35   protected final String JavaDoc TEXT_16 = NL;
36   protected final String JavaDoc TEXT_17 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
37   protected final String JavaDoc TEXT_18 = " ";
38   protected final String JavaDoc TEXT_19 = " = null;" + NL;
39   protected final String JavaDoc TEXT_20 = NL + "\t/**" + NL + "\t * Creates an instance of the model <b>Package</b>, registered with" + NL + "\t * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package" + NL + "\t * package URI value." + NL + "\t * <p>Note: the correct way to create the package is via the static" + NL + "\t * factory method {@link #init init()}, which also performs" + NL + "\t * initialization of the package, or returns the registered package," + NL + "\t * if one already exists." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @see org.eclipse.emf.ecore.EPackage.Registry" + NL + "\t * @see ";
40   protected final String JavaDoc TEXT_21 = "#eNS_URI" + NL + "\t * @see #init()" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
41   protected final String JavaDoc TEXT_22 = "()" + NL + "\t{" + NL + "\t\tsuper(eNS_URI, ";
42   protected final String JavaDoc TEXT_23 = ".eINSTANCE);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static boolean isInited = false;" + NL + "" + NL + "\t/**" + NL + "\t * Creates, registers, and initializes the <b>Package</b> for this" + NL + "\t * model, and for any others upon which it depends. Simple" + NL + "\t * dependencies are satisfied by calling this method on all" + NL + "\t * dependent packages before doing anything else. This method drives" + NL + "\t * initialization for interdependent packages directly, in parallel" + NL + "\t * with this package, itself." + NL + "\t * <p>Of this package and its interdependencies, all packages which" + NL + "\t * have not yet been registered by their URI values are first created" + NL + "\t * and registered. The packages are then initialized in two steps:" + NL + "\t * meta-model objects for all of the packages are created before any" + NL + "\t * are initialized, since one package's meta-model objects may refer to" + NL + "\t * those of another." + NL + "\t * <p>Invocation of this method will not affect any packages that have" + NL + "\t * already been initialized." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @see #eNS_URI";
43   protected final String JavaDoc TEXT_24 = NL + "\t * @see #createPackageContents()" + NL + "\t * @see #initializePackageContents()";
44   protected final String JavaDoc TEXT_25 = NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
45   protected final String JavaDoc TEXT_26 = " init()" + NL + "\t{" + NL + "\t\tif (isInited) return (";
46   protected final String JavaDoc TEXT_27 = ")";
47   protected final String JavaDoc TEXT_28 = ".Registry.INSTANCE.getEPackage(";
48   protected final String JavaDoc TEXT_29 = ".eNS_URI);" + NL + "" + NL + "\t\t// Obtain or create and register package" + NL + "\t\t";
49   protected final String JavaDoc TEXT_30 = " the";
50   protected final String JavaDoc TEXT_31 = " = (";
51   protected final String JavaDoc TEXT_32 = ")(";
52   protected final String JavaDoc TEXT_33 = ".Registry.INSTANCE.getEPackage(eNS_URI) instanceof ";
53   protected final String JavaDoc TEXT_34 = " ? ";
54   protected final String JavaDoc TEXT_35 = ".Registry.INSTANCE.getEPackage(eNS_URI) : new ";
55   protected final String JavaDoc TEXT_36 = "());" + NL + "" + NL + "\t\tisInited = true;" + NL;
56   protected final String JavaDoc TEXT_37 = NL + "\t\t// Initialize simple dependencies";
57   protected final String JavaDoc TEXT_38 = NL + "\t\t";
58   protected final String JavaDoc TEXT_39 = ".init();";
59   protected final String JavaDoc TEXT_40 = NL;
60   protected final String JavaDoc TEXT_41 = NL + "\t\t// Obtain or create and register interdependencies";
61   protected final String JavaDoc TEXT_42 = NL + "\t\t";
62   protected final String JavaDoc TEXT_43 = " ";
63   protected final String JavaDoc TEXT_44 = " = (";
64   protected final String JavaDoc TEXT_45 = ")(";
65   protected final String JavaDoc TEXT_46 = ".Registry.INSTANCE.getEPackage(";
66   protected final String JavaDoc TEXT_47 = ".eNS_URI) instanceof ";
67   protected final String JavaDoc TEXT_48 = " ? ";
68   protected final String JavaDoc TEXT_49 = ".Registry.INSTANCE.getEPackage(";
69   protected final String JavaDoc TEXT_50 = ".eNS_URI) : ";
70   protected final String JavaDoc TEXT_51 = ".eINSTANCE);";
71   protected final String JavaDoc TEXT_52 = NL;
72   protected final String JavaDoc TEXT_53 = NL + "\t\t// Load packages";
73   protected final String JavaDoc TEXT_54 = NL + "\t\tthe";
74   protected final String JavaDoc TEXT_55 = ".loadPackage();";
75   protected final String JavaDoc TEXT_56 = NL + "\t\t";
76   protected final String JavaDoc TEXT_57 = ".loadPackage();";
77   protected final String JavaDoc TEXT_58 = NL;
78   protected final String JavaDoc TEXT_59 = NL + "\t\t// Create package meta-data objects";
79   protected final String JavaDoc TEXT_60 = NL + "\t\tthe";
80   protected final String JavaDoc TEXT_61 = ".createPackageContents();";
81   protected final String JavaDoc TEXT_62 = NL + "\t\t";
82   protected final String JavaDoc TEXT_63 = ".createPackageContents();";
83   protected final String JavaDoc TEXT_64 = NL + NL + "\t\t// Initialize created meta-data";
84   protected final String JavaDoc TEXT_65 = NL + "\t\tthe";
85   protected final String JavaDoc TEXT_66 = ".initializePackageContents();";
86   protected final String JavaDoc TEXT_67 = NL + "\t\t";
87   protected final String JavaDoc TEXT_68 = ".initializePackageContents();";
88   protected final String JavaDoc TEXT_69 = NL;
89   protected final String JavaDoc TEXT_70 = NL + "\t\t// Fix loaded packages";
90   protected final String JavaDoc TEXT_71 = NL + "\t\tthe";
91   protected final String JavaDoc TEXT_72 = ".fixPackageContents();";
92   protected final String JavaDoc TEXT_73 = NL + "\t\t";
93   protected final String JavaDoc TEXT_74 = ".fixPackageContents();";
94   protected final String JavaDoc TEXT_75 = NL;
95   protected final String JavaDoc TEXT_76 = NL + "\t\t// Register package validator" + NL + "\t\t";
96   protected final String JavaDoc TEXT_77 = ".Registry.INSTANCE.put" + NL + "\t\t\t(the";
97   protected final String JavaDoc TEXT_78 = ", " + NL + "\t\t\t new ";
98   protected final String JavaDoc TEXT_79 = ".Descriptor()" + NL + "\t\t\t {" + NL + "\t\t\t\t public ";
99   protected final String JavaDoc TEXT_80 = " getEValidator()" + NL + "\t\t\t\t {" + NL + "\t\t\t\t\t return ";
100   protected final String JavaDoc TEXT_81 = ".INSTANCE;" + NL + "\t\t\t\t }" + NL + "\t\t\t });" + NL;
101   protected final String JavaDoc TEXT_82 = NL + "\t\t// Mark meta-data to indicate it can't be changed" + NL + "\t\tthe";
102   protected final String JavaDoc TEXT_83 = ".freeze();" + NL;
103   protected final String JavaDoc TEXT_84 = NL + "\t\treturn the";
104   protected final String JavaDoc TEXT_85 = ";" + NL + "\t}" + NL;
105   protected final String JavaDoc TEXT_86 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
106   protected final String JavaDoc TEXT_87 = " get";
107   protected final String JavaDoc TEXT_88 = "()" + NL + "\t{";
108   protected final String JavaDoc TEXT_89 = NL + "\t\tif (";
109   protected final String JavaDoc TEXT_90 = " == null)" + NL + "\t\t{" + NL + "\t\t\t";
110   protected final String JavaDoc TEXT_91 = " = (";
111   protected final String JavaDoc TEXT_92 = ")";
112   protected final String JavaDoc TEXT_93 = ".Registry.INSTANCE.getEPackage(";
113   protected final String JavaDoc TEXT_94 = ".eNS_URI).getEClassifiers().get(";
114   protected final String JavaDoc TEXT_95 = ");" + NL + "\t\t}";
115   protected final String JavaDoc TEXT_96 = NL + "\t\treturn ";
116   protected final String JavaDoc TEXT_97 = ";" + NL + "\t}" + NL;
117   protected final String JavaDoc TEXT_98 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
118   protected final String JavaDoc TEXT_99 = " get";
119   protected final String JavaDoc TEXT_100 = "()" + NL + "\t{";
120   protected final String JavaDoc TEXT_101 = NL + "\t\treturn (";
121   protected final String JavaDoc TEXT_102 = ")";
122   protected final String JavaDoc TEXT_103 = ".getEStructuralFeatures().get(";
123   protected final String JavaDoc TEXT_104 = ");";
124   protected final String JavaDoc TEXT_105 = NL + " return (";
125   protected final String JavaDoc TEXT_106 = ")get";
126   protected final String JavaDoc TEXT_107 = "().getEStructuralFeatures().get(";
127   protected final String JavaDoc TEXT_108 = ");";
128   protected final String JavaDoc TEXT_109 = NL + "\t}" + NL;
129   protected final String JavaDoc TEXT_110 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
130   protected final String JavaDoc TEXT_111 = " get";
131   protected final String JavaDoc TEXT_112 = "()" + NL + "\t{" + NL + "\t\treturn (";
132   protected final String JavaDoc TEXT_113 = ")getEFactoryInstance();" + NL + "\t}" + NL;
133   protected final String JavaDoc TEXT_114 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isCreated = false;" + NL + "" + NL + "\t/**" + NL + "\t * Creates the meta-model objects for the package. This method is" + NL + "\t * guarded to have no affect on any invocation but its first." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createPackageContents()" + NL + "\t{" + NL + "\t\tif (isCreated) return;" + NL + "\t\tisCreated = true;";
134   protected final String JavaDoc TEXT_115 = NL + NL + "\t\t// Create classes and their features";
135   protected final String JavaDoc TEXT_116 = NL + "\t\t";
136   protected final String JavaDoc TEXT_117 = " = create";
137   protected final String JavaDoc TEXT_118 = "(";
138   protected final String JavaDoc TEXT_119 = ");";
139   protected final String JavaDoc TEXT_120 = NL + "\t\tcreate";
140   protected final String JavaDoc TEXT_121 = "(";
141   protected final String JavaDoc TEXT_122 = ", ";
142   protected final String JavaDoc TEXT_123 = ");";
143   protected final String JavaDoc TEXT_124 = NL;
144   protected final String JavaDoc TEXT_125 = NL + NL + "\t\t// Create enums";
145   protected final String JavaDoc TEXT_126 = NL + "\t\t";
146   protected final String JavaDoc TEXT_127 = " = createEEnum(";
147   protected final String JavaDoc TEXT_128 = ");";
148   protected final String JavaDoc TEXT_129 = NL + NL + "\t\t// Create data types";
149   protected final String JavaDoc TEXT_130 = NL + "\t\t";
150   protected final String JavaDoc TEXT_131 = " = createEDataType(";
151   protected final String JavaDoc TEXT_132 = ");";
152   protected final String JavaDoc TEXT_133 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isInitialized = false;" + NL + "" + NL + "\t/**" + NL + "\t * Complete the initialization of the package and its meta-model. This" + NL + "\t * method is guarded to have no affect on any invocation but its first." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void initializePackageContents()" + NL + "\t{" + NL + "\t\tif (isInitialized) return;" + NL + "\t\tisInitialized = true;" + NL + "" + NL + "\t\t// Initialize package" + NL + "\t\tsetName(eNAME);" + NL + "\t\tsetNsPrefix(eNS_PREFIX);" + NL + "\t\tsetNsURI(eNS_URI);";
153   protected final String JavaDoc TEXT_134 = NL + NL + "\t\t// Obtain other dependent packages";
154   protected final String JavaDoc TEXT_135 = NL + "\t\t";
155   protected final String JavaDoc TEXT_136 = " ";
156   protected final String JavaDoc TEXT_137 = " = (";
157   protected final String JavaDoc TEXT_138 = ")";
158   protected final String JavaDoc TEXT_139 = ".Registry.INSTANCE.getEPackage(";
159   protected final String JavaDoc TEXT_140 = ".eNS_URI);";
160   protected final String JavaDoc TEXT_141 = NL + NL + "\t\t// Add subpackages";
161   protected final String JavaDoc TEXT_142 = NL + "\t\tgetESubpackages().add(";
162   protected final String JavaDoc TEXT_143 = ");";
163   protected final String JavaDoc TEXT_144 = NL + NL + "\t\t// Add supertypes to classes";
164   protected final String JavaDoc TEXT_145 = NL + "\t\t";
165   protected final String JavaDoc TEXT_146 = ".getESuperTypes().add(";
166   protected final String JavaDoc TEXT_147 = ".get";
167   protected final String JavaDoc TEXT_148 = "());";
168   protected final String JavaDoc TEXT_149 = NL + NL + "\t\t// Initialize classes and features; add operations and parameters";
169   protected final String JavaDoc TEXT_150 = NL + "\t\tinitEClass(";
170   protected final String JavaDoc TEXT_151 = ", ";
171   protected final String JavaDoc TEXT_152 = ".class, \"";
172   protected final String JavaDoc TEXT_153 = "\", ";
173   protected final String JavaDoc TEXT_154 = ", ";
174   protected final String JavaDoc TEXT_155 = ", ";
175   protected final String JavaDoc TEXT_156 = ");";
176   protected final String JavaDoc TEXT_157 = NL + "\t\tinitEReference(get";
177   protected final String JavaDoc TEXT_158 = "(), ";
178   protected final String JavaDoc TEXT_159 = ".get";
179   protected final String JavaDoc TEXT_160 = "(), ";
180   protected final String JavaDoc TEXT_161 = ", \"";
181   protected final String JavaDoc TEXT_162 = "\", ";
182   protected final String JavaDoc TEXT_163 = ", ";
183   protected final String JavaDoc TEXT_164 = ", ";
184   protected final String JavaDoc TEXT_165 = ", ";
185   protected final String JavaDoc TEXT_166 = ", ";
186   protected final String JavaDoc TEXT_167 = ", ";
187   protected final String JavaDoc TEXT_168 = ", ";
188   protected final String JavaDoc TEXT_169 = ", ";
189   protected final String JavaDoc TEXT_170 = ", ";
190   protected final String JavaDoc TEXT_171 = ", ";
191   protected final String JavaDoc TEXT_172 = ", ";
192   protected final String JavaDoc TEXT_173 = ", ";
193   protected final String JavaDoc TEXT_174 = ", ";
194   protected final String JavaDoc TEXT_175 = ");";
195   protected final String JavaDoc TEXT_176 = NL + "\t\tinitEAttribute(get";
196   protected final String JavaDoc TEXT_177 = "(), ";
197   protected final String JavaDoc TEXT_178 = ".get";
198   protected final String JavaDoc TEXT_179 = "(), \"";
199   protected final String JavaDoc TEXT_180 = "\", ";
200   protected final String JavaDoc TEXT_181 = ", ";
201   protected final String JavaDoc TEXT_182 = ", ";
202   protected final String JavaDoc TEXT_183 = ", ";
203   protected final String JavaDoc TEXT_184 = ", ";
204   protected final String JavaDoc TEXT_185 = ", ";
205   protected final String JavaDoc TEXT_186 = ", ";
206   protected final String JavaDoc TEXT_187 = ", ";
207   protected final String JavaDoc TEXT_188 = ", ";
208   protected final String JavaDoc TEXT_189 = ", ";
209   protected final String JavaDoc TEXT_190 = ", ";
210   protected final String JavaDoc TEXT_191 = ", ";
211   protected final String JavaDoc TEXT_192 = ");";
212   protected final String JavaDoc TEXT_193 = NL;
213   protected final String JavaDoc TEXT_194 = NL + "\t\t";
214   protected final String JavaDoc TEXT_195 = "addEOperation(";
215   protected final String JavaDoc TEXT_196 = ", ";
216   protected final String JavaDoc TEXT_197 = ".get";
217   protected final String JavaDoc TEXT_198 = "(), \"";
218   protected final String JavaDoc TEXT_199 = "\");";
219   protected final String JavaDoc TEXT_200 = NL + "\t\t";
220   protected final String JavaDoc TEXT_201 = "addEOperation(";
221   protected final String JavaDoc TEXT_202 = ", null, \"";
222   protected final String JavaDoc TEXT_203 = "\");";
223   protected final String JavaDoc TEXT_204 = NL + "\t\taddEParameter(op, ";
224   protected final String JavaDoc TEXT_205 = ".get";
225   protected final String JavaDoc TEXT_206 = "(), \"";
226   protected final String JavaDoc TEXT_207 = "\");";
227   protected final String JavaDoc TEXT_208 = NL + "\t\taddEException(op, ";
228   protected final String JavaDoc TEXT_209 = ".get";
229   protected final String JavaDoc TEXT_210 = "());";
230   protected final String JavaDoc TEXT_211 = NL;
231   protected final String JavaDoc TEXT_212 = NL + NL + "\t\t// Initialize enums and add enum literals";
232   protected final String JavaDoc TEXT_213 = NL + "\t\tinitEEnum(";
233   protected final String JavaDoc TEXT_214 = ", ";
234   protected final String JavaDoc TEXT_215 = ".class, \"";
235   protected final String JavaDoc TEXT_216 = "\");";
236   protected final String JavaDoc TEXT_217 = NL + "\t\taddEEnumLiteral(";
237   protected final String JavaDoc TEXT_218 = ", ";
238   protected final String JavaDoc TEXT_219 = ".";
239   protected final String JavaDoc TEXT_220 = "_LITERAL);";
240   protected final String JavaDoc TEXT_221 = NL;
241   protected final String JavaDoc TEXT_222 = NL + NL + "\t\t// Initialize data types";
242   protected final String JavaDoc TEXT_223 = NL + "\t\tinitEDataType(";
243   protected final String JavaDoc TEXT_224 = ", ";
244   protected final String JavaDoc TEXT_225 = ".class, \"";
245   protected final String JavaDoc TEXT_226 = "\", ";
246   protected final String JavaDoc TEXT_227 = ", ";
247   protected final String JavaDoc TEXT_228 = ");";
248   protected final String JavaDoc TEXT_229 = NL + NL + "\t\t// Create resource" + NL + "\t\tcreateResource(eNS_URI);";
249   protected final String JavaDoc TEXT_230 = NL + NL + "\t\t// Create annotations";
250   protected final String JavaDoc TEXT_231 = NL + "\t\t// ";
251   protected final String JavaDoc TEXT_232 = NL + "\t\tcreate";
252   protected final String JavaDoc TEXT_233 = "Annotations();";
253   protected final String JavaDoc TEXT_234 = NL + "\t}" + NL;
254   protected final String JavaDoc TEXT_235 = NL + "\t/**" + NL + "\t * Initializes the annotations for <b>";
255   protected final String JavaDoc TEXT_236 = "</b>." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void create";
256   protected final String JavaDoc TEXT_237 = "Annotations()" + NL + "\t{" + NL + "\t\tString source = ";
257   protected final String JavaDoc TEXT_238 = "null;";
258   protected final String JavaDoc TEXT_239 = "\"";
259   protected final String JavaDoc TEXT_240 = "\";";
260   protected final String JavaDoc TEXT_241 = "\t";
261   protected final String JavaDoc TEXT_242 = "\t" + NL + "\t\taddAnnotation" + NL + "\t\t (";
262   protected final String JavaDoc TEXT_243 = ", " + NL + "\t\t source, " + NL + "\t\t new String[] " + NL + "\t\t {";
263   protected final String JavaDoc TEXT_244 = NL + "\t\t\t ";
264   protected final String JavaDoc TEXT_245 = ", ";
265   protected final String JavaDoc TEXT_246 = NL + "\t\t });";
266   protected final String JavaDoc TEXT_247 = NL + "\t}" + NL;
267   protected final String JavaDoc TEXT_248 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isLoaded = false;" + NL + "" + NL + "\t/**" + NL + "\t * Laods the package and any sub-packages from their serialized form." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void loadPackage()" + NL + "\t{" + NL + "\t\tif (isLoaded) return;" + NL + "\t\tisLoaded = true;" + NL + "" + NL + "\t\t";
268   protected final String JavaDoc TEXT_249 = " url = getClass().getResource(packageFilename);" + NL + "\t\tif (url == null)" + NL + "\t\t{" + NL + "\t\t\tthrow new RuntimeException(\"Missing serialized package: \" + packageFilename);";
269   protected final String JavaDoc TEXT_250 = NL + "\t\t}" + NL + "\t\t";
270   protected final String JavaDoc TEXT_251 = " uri = ";
271   protected final String JavaDoc TEXT_252 = ".createURI(url.toString());" + NL + "\t\t";
272   protected final String JavaDoc TEXT_253 = " resource = new ";
273   protected final String JavaDoc TEXT_254 = "().createResource(";
274   protected final String JavaDoc TEXT_255 = ".createURI(url.toString()));" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\tresource.load(null);" + NL + "\t\t}" + NL + "\t\tcatch (";
275   protected final String JavaDoc TEXT_256 = " exception)" + NL + "\t\t{" + NL + "\t\t\tthrow new ";
276   protected final String JavaDoc TEXT_257 = "(exception);" + NL + "\t\t}" + NL + "\t\tinitializeFromLoadedEPackage(this, (";
277   protected final String JavaDoc TEXT_258 = ")resource.getContents().get(0));" + NL + "\t\tcreateResource(eNS_URI);" + NL + "\t}" + NL;
278   protected final String JavaDoc TEXT_259 = NL + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isFixed = false;" + NL + "" + NL + "\t/**" + NL + "\t * Fixes up the loaded package, to make it appear as if it had been programmatically built." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void fixPackageContents()" + NL + "\t{" + NL + "\t\tif (isFixed) return;" + NL + "\t\tisFixed = true;" + NL + "\t\tfixEClassifiers();" + NL + "\t}";
279   protected final String JavaDoc TEXT_260 = NL + "} //";
280   protected final String JavaDoc TEXT_261 = NL;
281
282   public String JavaDoc generate(Object JavaDoc argument)
283   {
284     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
285     
286 /**
287  * <copyright>
288  *
289  * Copyright (c) 2002-2004 IBM Corporation and others.
290  * All rights reserved. This program and the accompanying materials
291  * are made available under the terms of the Eclipse Public License v1.0
292  * which accompanies this distribution, and is available at
293  * http://www.eclipse.org/legal/epl-v10.html
294  *
295  * Contributors:
296  * IBM - Initial API and implementation
297  *
298  * </copyright>
299  */

300
301     GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
302     stringBuffer.append(TEXT_1);
303     stringBuffer.append(TEXT_2);
304     stringBuffer.append("$");
305     stringBuffer.append(TEXT_3);
306     stringBuffer.append("$");
307     stringBuffer.append(TEXT_4);
308     stringBuffer.append(genPackage.getClassPackageName());
309     stringBuffer.append(TEXT_5);
310     genModel.markImportLocation(stringBuffer);
311     genModel.addPseudoImport("org.eclipse.emf.ecore.EPackage.Registry");
312     genModel.addPseudoImport("org.eclipse.emf.ecore.EPackage.Descriptor");
313     for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + "." + genPackage.getClassifierID((GenClassifier)i.next()));
314     stringBuffer.append(TEXT_6);
315     stringBuffer.append(genPackage.getPackageClassName());
316     stringBuffer.append(TEXT_7);
317     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.EPackageImpl"));
318     stringBuffer.append(TEXT_8);
319     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
320     stringBuffer.append(TEXT_9);
321     if (genModel.getCopyrightText() != null) {
322     stringBuffer.append(TEXT_10);
323     stringBuffer.append(genModel.getImportedName("java.lang.String"));
324     stringBuffer.append(TEXT_11);
325     stringBuffer.append(genModel.getCopyrightText());
326     stringBuffer.append(TEXT_12);
327     stringBuffer.append(genModel.getNonNLS());
328     stringBuffer.append(TEXT_13);
329     }
330     if (genPackage.isLoadingInitialization()) {
331     stringBuffer.append(TEXT_14);
332     stringBuffer.append(genPackage.getSerializedPackageFilename());
333     stringBuffer.append(TEXT_15);
334     stringBuffer.append(genModel.getNonNLS());
335     stringBuffer.append(TEXT_16);
336     }
337     for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next();
338     stringBuffer.append(TEXT_17);
339     stringBuffer.append(genClassifier.getImportedMetaType());
340     stringBuffer.append(TEXT_18);
341     stringBuffer.append(genClassifier.getClassifierInstanceName());
342     stringBuffer.append(TEXT_19);
343     }
344     stringBuffer.append(TEXT_20);
345     stringBuffer.append(genPackage.getQualifiedPackageInterfaceName());
346     stringBuffer.append(TEXT_21);
347     stringBuffer.append(genPackage.getPackageClassName());
348     stringBuffer.append(TEXT_22);
349     stringBuffer.append(genPackage.getImportedFactoryInterfaceName());
350     stringBuffer.append(TEXT_23);
351     if (!genPackage.isLoadedInitialization()) {
352     stringBuffer.append(TEXT_24);
353     }
354     stringBuffer.append(TEXT_25);
355     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
356     stringBuffer.append(TEXT_26);
357     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
358     stringBuffer.append(TEXT_27);
359     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
360     stringBuffer.append(TEXT_28);
361     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
362     stringBuffer.append(TEXT_29);
363     stringBuffer.append(genPackage.getPackageClassName());
364     stringBuffer.append(TEXT_30);
365     stringBuffer.append(genPackage.getPackageInterfaceName());
366     stringBuffer.append(TEXT_31);
367     stringBuffer.append(genPackage.getPackageClassName());
368     stringBuffer.append(TEXT_32);
369     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
370     stringBuffer.append(TEXT_33);
371     stringBuffer.append(genPackage.getPackageClassName());
372     stringBuffer.append(TEXT_34);
373     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
374     stringBuffer.append(TEXT_35);
375     stringBuffer.append(genPackage.getPackageClassName());
376     stringBuffer.append(TEXT_36);
377     if (!genPackage.getPackageSimpleDependencies().isEmpty()) {
378     stringBuffer.append(TEXT_37);
379     for (Iterator p=genPackage.getPackageSimpleDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next();
380     stringBuffer.append(TEXT_38);
381     stringBuffer.append(dep.getImportedPackageClassName());
382     stringBuffer.append(TEXT_39);
383     }
384     stringBuffer.append(TEXT_40);
385     }
386     if (!genPackage.getPackageInterDependencies().isEmpty()) {
387     stringBuffer.append(TEXT_41);
388     for (Iterator p=genPackage.getPackageInterDependencies().iterator(); p.hasNext();) { GenPackage interdep = (GenPackage)p.next();
389     stringBuffer.append(TEXT_42);
390     stringBuffer.append(interdep.getImportedPackageClassName());
391     stringBuffer.append(TEXT_43);
392     stringBuffer.append(genPackage.getPackageInstanceVariable(interdep));
393     stringBuffer.append(TEXT_44);
394     stringBuffer.append(interdep.getImportedPackageClassName());
395     stringBuffer.append(TEXT_45);
396     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
397     stringBuffer.append(TEXT_46);
398     stringBuffer.append(interdep.getImportedPackageInterfaceName());
399     stringBuffer.append(TEXT_47);
400     stringBuffer.append(interdep.getImportedPackageClassName());
401     stringBuffer.append(TEXT_48);
402     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
403     stringBuffer.append(TEXT_49);
404     stringBuffer.append(interdep.getImportedPackageInterfaceName());
405     stringBuffer.append(TEXT_50);
406     stringBuffer.append(interdep.getImportedPackageInterfaceName());
407     stringBuffer.append(TEXT_51);
408     }
409     stringBuffer.append(TEXT_52);
410     }
411     if (genPackage.isLoadedInitialization() || !genPackage.getPackageLoadInterDependencies().isEmpty()) {
412     stringBuffer.append(TEXT_53);
413     if (genPackage.isLoadingInitialization()) {
414     stringBuffer.append(TEXT_54);
415     stringBuffer.append(genPackage.getPackageInterfaceName());
416     stringBuffer.append(TEXT_55);
417     }
418     for (Iterator p=genPackage.getPackageLoadInterDependencies().iterator(); p.hasNext();) { GenPackage interdep = (GenPackage)p.next();
419     if (interdep.isLoadingInitialization()) {
420     stringBuffer.append(TEXT_56);
421     stringBuffer.append(genPackage.getPackageInstanceVariable(interdep));
422     stringBuffer.append(TEXT_57);
423     }
424     }
425     stringBuffer.append(TEXT_58);
426     }
427     if (!genPackage.isLoadedInitialization() || !genPackage.getPackageBuildInterDependencies().isEmpty()) {
428     stringBuffer.append(TEXT_59);
429     if (!genPackage.isLoadedInitialization()) {
430     stringBuffer.append(TEXT_60);
431     stringBuffer.append(genPackage.getPackageInterfaceName());
432     stringBuffer.append(TEXT_61);
433     }
434     for (Iterator p=genPackage.getPackageBuildInterDependencies().iterator(); p.hasNext();) { GenPackage interdep = (GenPackage)p.next();
435     stringBuffer.append(TEXT_62);
436     stringBuffer.append(genPackage.getPackageInstanceVariable(interdep));
437     stringBuffer.append(TEXT_63);
438     }
439     stringBuffer.append(TEXT_64);
440     if (!genPackage.isLoadedInitialization()) {
441     stringBuffer.append(TEXT_65);
442     stringBuffer.append(genPackage.getPackageInterfaceName());
443     stringBuffer.append(TEXT_66);
444     }
445     for (Iterator p=genPackage.getPackageBuildInterDependencies().iterator(); p.hasNext();) { GenPackage interdep = (GenPackage)p.next();
446     stringBuffer.append(TEXT_67);
447     stringBuffer.append(genPackage.getPackageInstanceVariable(interdep));
448     stringBuffer.append(TEXT_68);
449     }
450     stringBuffer.append(TEXT_69);
451     }
452     if (genPackage.isLoadedInitialization() || !genPackage.getPackageLoadInterDependencies().isEmpty()) {
453     stringBuffer.append(TEXT_70);
454     if (genPackage.isLoadedInitialization()) {
455     stringBuffer.append(TEXT_71);
456     stringBuffer.append(genPackage.getPackageInterfaceName());
457     stringBuffer.append(TEXT_72);
458     }
459     for (Iterator p=genPackage.getPackageLoadInterDependencies().iterator(); p.hasNext();) { GenPackage interdep = (GenPackage)p.next();
460     stringBuffer.append(TEXT_73);
461     stringBuffer.append(genPackage.getPackageInstanceVariable(interdep));
462     stringBuffer.append(TEXT_74);
463     }
464     stringBuffer.append(TEXT_75);
465     }
466     if (genPackage.hasConstraints()) {
467     stringBuffer.append(TEXT_76);
468     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EValidator"));
469     stringBuffer.append(TEXT_77);
470     stringBuffer.append(genPackage.getPackageInterfaceName());
471     stringBuffer.append(TEXT_78);
472     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EValidator"));
473     stringBuffer.append(TEXT_79);
474     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EValidator"));
475     stringBuffer.append(TEXT_80);
476     stringBuffer.append(genPackage.getImportedValidatorClassName());
477     stringBuffer.append(TEXT_81);
478     }
479     if (!genPackage.isEcorePackage()) {
480     stringBuffer.append(TEXT_82);
481     stringBuffer.append(genPackage.getPackageInterfaceName());
482     stringBuffer.append(TEXT_83);
483     }
484     stringBuffer.append(TEXT_84);
485     stringBuffer.append(genPackage.getPackageInterfaceName());
486     stringBuffer.append(TEXT_85);
487     for (Iterator m=genPackage.getGenClassifiers().iterator(); m.hasNext();) { GenClassifier genClassifier = (GenClassifier)m.next();
488     stringBuffer.append(TEXT_86);
489     stringBuffer.append(genClassifier.getImportedMetaType());
490     stringBuffer.append(TEXT_87);
491     stringBuffer.append(genClassifier.getClassifierAccessorName());
492     stringBuffer.append(TEXT_88);
493     if (genPackage.isLoadedInitialization()) {
494     stringBuffer.append(TEXT_89);
495     stringBuffer.append(genClassifier.getClassifierInstanceName());
496     stringBuffer.append(TEXT_90);
497     stringBuffer.append(genClassifier.getClassifierInstanceName());
498     stringBuffer.append(TEXT_91);
499     stringBuffer.append(genClassifier.getImportedMetaType());
500     stringBuffer.append(TEXT_92);
501     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
502     stringBuffer.append(TEXT_93);
503     stringBuffer.append(genPackage.getImportedPackageInterfaceName());
504     stringBuffer.append(TEXT_94);
505     stringBuffer.append(genPackage.getLocalClassifierIndex(genClassifier));
506     stringBuffer.append(TEXT_95);
507     }
508     stringBuffer.append(TEXT_96);
509     stringBuffer.append(genClassifier.getClassifierInstanceName());
510     stringBuffer.append(TEXT_97);
511     if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;
512     for (Iterator f=genClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();
513     stringBuffer.append(TEXT_98);
514     stringBuffer.append(genFeature.getImportedMetaType());
515     stringBuffer.append(TEXT_99);
516     stringBuffer.append(genFeature.getFeatureAccessorName());
517     stringBuffer.append(TEXT_100);
518     if (!genPackage.isLoadedInitialization()) {
519     stringBuffer.append(TEXT_101);
520     stringBuffer.append(genFeature.getImportedMetaType());
521     stringBuffer.append(TEXT_102);
522     stringBuffer.append(genClass.getClassifierInstanceName());
523     stringBuffer.append(TEXT_103);
524     stringBuffer.append(genClass.getLocalFeatureIndex(genFeature));
525     stringBuffer.append(TEXT_104);
526     } else {
527     stringBuffer.append(TEXT_105);
528     stringBuffer.append(genFeature.getImportedMetaType());
529     stringBuffer.append(TEXT_106);
530     stringBuffer.append(genClassifier.getClassifierAccessorName());
531     stringBuffer.append(TEXT_107);
532     stringBuffer.append(genClass.getLocalFeatureIndex(genFeature));
533     stringBuffer.append(TEXT_108);
534     }
535     stringBuffer.append(TEXT_109);
536     }
537     }
538     }
539     stringBuffer.append(TEXT_110);
540     stringBuffer.append(genPackage.getImportedFactoryInterfaceName());
541     stringBuffer.append(TEXT_111);
542     stringBuffer.append(genPackage.getFactoryInterfaceName());
543     stringBuffer.append(TEXT_112);
544     stringBuffer.append(genPackage.getImportedFactoryInterfaceName());
545     stringBuffer.append(TEXT_113);
546     if (!genPackage.isLoadedInitialization()) {
547     stringBuffer.append(TEXT_114);
548     if (!genPackage.getGenClasses().isEmpty()) {
549     stringBuffer.append(TEXT_115);
550     for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next();
551     stringBuffer.append(TEXT_116);
552     stringBuffer.append(genClass.getClassifierInstanceName());
553     stringBuffer.append(TEXT_117);
554     stringBuffer.append(genClass.getMetaType());
555     stringBuffer.append(TEXT_118);
556     stringBuffer.append(genClass.getClassifierID());
557     stringBuffer.append(TEXT_119);
558     for (Iterator f=genClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();
559     stringBuffer.append(TEXT_120);
560     stringBuffer.append(genFeature.getMetaType());
561     stringBuffer.append(TEXT_121);
562     stringBuffer.append(genClass.getClassifierInstanceName());
563     stringBuffer.append(TEXT_122);
564     stringBuffer.append(genClass.getFeatureID(genFeature));
565     stringBuffer.append(TEXT_123);
566     }
567     if (c.hasNext()) {
568     stringBuffer.append(TEXT_124);
569     }
570     }
571     }
572     if (!genPackage.getGenEnums().isEmpty()) {
573     stringBuffer.append(TEXT_125);
574     for (Iterator e=genPackage.getGenEnums().iterator(); e.hasNext();) { GenEnum genEnum = (GenEnum)e.next();
575     stringBuffer.append(TEXT_126);
576     stringBuffer.append(genEnum.getClassifierInstanceName());
577     stringBuffer.append(TEXT_127);
578     stringBuffer.append(genEnum.getClassifierID());
579     stringBuffer.append(TEXT_128);
580     }
581     }
582     if (!genPackage.getGenDataTypes().isEmpty()) {
583     stringBuffer.append(TEXT_129);
584     for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next();
585     stringBuffer.append(TEXT_130);
586     stringBuffer.append(genDataType.getClassifierInstanceName());
587     stringBuffer.append(TEXT_131);
588     stringBuffer.append(genDataType.getClassifierID());
589     stringBuffer.append(TEXT_132);
590     }
591     }
592     stringBuffer.append(TEXT_133);
593     if (!genPackage.getPackageInitializationDependencies().isEmpty()) {
594     stringBuffer.append(TEXT_134);
595     for (Iterator p=genPackage.getPackageInitializationDependencies().iterator(); p.hasNext();) { GenPackage dep = (GenPackage)p.next();
596     stringBuffer.append(TEXT_135);
597     stringBuffer.append(dep.getImportedPackageClassName());
598     stringBuffer.append(TEXT_136);
599     stringBuffer.append(genPackage.getPackageInstanceVariable(dep));
600     stringBuffer.append(TEXT_137);
601     stringBuffer.append(dep.getImportedPackageClassName());
602     stringBuffer.append(TEXT_138);
603     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
604     stringBuffer.append(TEXT_139);
605     stringBuffer.append(dep.getImportedPackageInterfaceName());
606     stringBuffer.append(TEXT_140);
607     }
608     }
609     if (!genPackage.getSubGenPackages().isEmpty()) {
610     stringBuffer.append(TEXT_141);
611     for (Iterator p=genPackage.getSubGenPackages().iterator(); p.hasNext();) { GenPackage sub = (GenPackage)p.next();
612     stringBuffer.append(TEXT_142);
613     stringBuffer.append(genPackage.getPackageInstanceVariable(sub));
614     stringBuffer.append(TEXT_143);
615     }
616     }
617     if (!genPackage.getGenClasses().isEmpty()) { boolean firstOperationAssignment = true;
618     stringBuffer.append(TEXT_144);
619     for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next();
620     for (Iterator b=genClass.getBaseGenClasses().iterator(); b.hasNext();) { GenClass baseGenClass = (GenClass)b.next();
621     stringBuffer.append(TEXT_145);
622     stringBuffer.append(genClass.getClassifierInstanceName());
623     stringBuffer.append(TEXT_146);
624     stringBuffer.append(genPackage.getPackageInstanceVariable(baseGenClass.getGenPackage()));
625     stringBuffer.append(TEXT_147);
626     stringBuffer.append(baseGenClass.getClassifierAccessorName());
627     stringBuffer.append(TEXT_148);
628     }
629     }
630     stringBuffer.append(TEXT_149);
631     for (Iterator c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = (GenClass)c.next();
632     stringBuffer.append(TEXT_150);
633     stringBuffer.append(genClass.getClassifierInstanceName());
634     stringBuffer.append(TEXT_151);
635     stringBuffer.append(genClass.getImportedInterfaceName());
636     stringBuffer.append(TEXT_152);
637     stringBuffer.append(genClass.getName());
638     stringBuffer.append(TEXT_153);
639     stringBuffer.append(genClass.getAbstractFlag());
640     stringBuffer.append(TEXT_154);
641     stringBuffer.append(genClass.getInterfaceFlag());
642     stringBuffer.append(TEXT_155);
643     stringBuffer.append(genClass.getGeneratedInstanceClassFlag());
644     stringBuffer.append(TEXT_156);
645     stringBuffer.append(genModel.getNonNLS());
646     for (Iterator f=genClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next();
647     if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse();
648     String JavaDoc reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()";
649     stringBuffer.append(TEXT_157);
650     stringBuffer.append(genFeature.getFeatureAccessorName());
651     stringBuffer.append(TEXT_158);
652     stringBuffer.append(genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()));
653     stringBuffer.append(TEXT_159);
654     stringBuffer.append(genFeature.getTypeClassifierAccessorName());
655     stringBuffer.append(TEXT_160);
656     stringBuffer.append(reverse);
657     stringBuffer.append(TEXT_161);
658     stringBuffer.append(genFeature.getName());
659     stringBuffer.append(TEXT_162);
660     stringBuffer.append(genFeature.getDefaultValue());
661     stringBuffer.append(TEXT_163);
662     stringBuffer.append(genFeature.getLowerBound());
663     stringBuffer.append(TEXT_164);
664     stringBuffer.append(genFeature.getUpperBound());
665     stringBuffer.append(TEXT_165);
666     stringBuffer.append(genFeature.getContainerClass());
667     stringBuffer.append(TEXT_166);
668     stringBuffer.append(genFeature.getTransientFlag());
669     stringBuffer.append(TEXT_167);
670     stringBuffer.append(genFeature.getVolatileFlag());
671     stringBuffer.append(TEXT_168);
672     stringBuffer.append(genFeature.getChangeableFlag());
673     stringBuffer.append(TEXT_169);
674     stringBuffer.append(genFeature.getContainmentFlag());
675     stringBuffer.append(TEXT_170);
676     stringBuffer.append(genFeature.getResolveProxiesFlag());
677     stringBuffer.append(TEXT_171);
678     stringBuffer.append(genFeature.getUnsettableFlag());
679     stringBuffer.append(TEXT_172);
680     stringBuffer.append(genFeature.getUniqueFlag());
681     stringBuffer.append(TEXT_173);
682     stringBuffer.append(genFeature.getDerivedFlag());
683     stringBuffer.append(TEXT_174);
684     stringBuffer.append(genFeature.getOrderedFlag());
685     stringBuffer.append(TEXT_175);
686     stringBuffer.append(genModel.getNonNLS());
687     stringBuffer.append(genModel.getNonNLS(genFeature.getDefaultValue(), 2));
688     } else {
689     stringBuffer.append(TEXT_176);
690     stringBuffer.append(genFeature.getFeatureAccessorName());
691     stringBuffer.append(TEXT_177);
692     stringBuffer.append(genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()));
693     stringBuffer.append(TEXT_178);
694     stringBuffer.append(genFeature.getTypeClassifierAccessorName());
695     stringBuffer.append(TEXT_179);
696     stringBuffer.append(genFeature.getName());
697     stringBuffer.append(TEXT_180);
698     stringBuffer.append(genFeature.getDefaultValue());
699     stringBuffer.append(TEXT_181);
700     stringBuffer.append(genFeature.getLowerBound());
701     stringBuffer.append(TEXT_182);
702     stringBuffer.append(genFeature.getUpperBound());
703     stringBuffer.append(TEXT_183);
704     stringBuffer.append(genFeature.getContainerClass());
705     stringBuffer.append(TEXT_184);
706     stringBuffer.append(genFeature.getTransientFlag());
707     stringBuffer.append(TEXT_185);
708     stringBuffer.append(genFeature.getVolatileFlag());
709     stringBuffer.append(TEXT_186);
710     stringBuffer.append(genFeature.getChangeableFlag());
711     stringBuffer.append(TEXT_187);
712     stringBuffer.append(genFeature.getUnsettableFlag());
713     stringBuffer.append(TEXT_188);
714     stringBuffer.append(genFeature.getIDFlag());
715     stringBuffer.append(TEXT_189);
716     stringBuffer.append(genFeature.getUniqueFlag());
717     stringBuffer.append(TEXT_190);
718     stringBuffer.append(genFeature.getDerivedFlag());
719     stringBuffer.append(TEXT_191);
720     stringBuffer.append(genFeature.getOrderedFlag());
721     stringBuffer.append(TEXT_192);
722     stringBuffer.append(genModel.getNonNLS());
723     stringBuffer.append(genModel.getNonNLS(genFeature.getDefaultValue(), 2));
724     }
725     }
726     for (Iterator o=genClass.getGenOperations().iterator(); o.hasNext();) { GenOperation genOperation = (GenOperation)o.next(); String JavaDoc prefix = ""; if (!genOperation.getGenParameters().isEmpty() || !genOperation.getGenExceptions().isEmpty()) { if (firstOperationAssignment) { firstOperationAssignment = false; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EOperation") + " op = "; } else { prefix = "op = "; }}
727     stringBuffer.append(TEXT_193);
728     if (!genOperation.isVoid()) {
729     stringBuffer.append(TEXT_194);
730     stringBuffer.append(prefix);
731     stringBuffer.append(TEXT_195);
732     stringBuffer.append(genClass.getClassifierInstanceName());
733     stringBuffer.append(TEXT_196);
734     stringBuffer.append(genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage()));
735     stringBuffer.append(TEXT_197);
736     stringBuffer.append(genOperation.getTypeClassifierAccessorName());
737     stringBuffer.append(TEXT_198);
738     stringBuffer.append(genOperation.getName());
739     stringBuffer.append(TEXT_199);
740     stringBuffer.append(genModel.getNonNLS());
741     } else {
742     stringBuffer.append(TEXT_200);
743     stringBuffer.append(prefix);
744     stringBuffer.append(TEXT_201);
745     stringBuffer.append(genClass.getClassifierInstanceName());
746     stringBuffer.append(TEXT_202);
747     stringBuffer.append(genOperation.getName());
748     stringBuffer.append(TEXT_203);
749     stringBuffer.append(genModel.getNonNLS());
750     }
751     for (Iterator p=genOperation.getGenParameters().iterator(); p.hasNext();) { GenParameter genParameter = (GenParameter)p.next();
752     stringBuffer.append(TEXT_204);
753     stringBuffer.append(genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage()));
754     stringBuffer.append(TEXT_205);
755     stringBuffer.append(genParameter.getTypeClassifierAccessorName());
756     stringBuffer.append(TEXT_206);
757     stringBuffer.append(genParameter.getName());
758     stringBuffer.append(TEXT_207);
759     stringBuffer.append(genModel.getNonNLS());
760     }
761     for (Iterator p=genOperation.getGenExceptions().iterator(); p.hasNext();) { GenClassifier genException = (GenClassifier)p.next();
762     stringBuffer.append(TEXT_208);
763     stringBuffer.append(genPackage.getPackageInstanceVariable(genException.getGenPackage()));
764     stringBuffer.append(TEXT_209);
765     stringBuffer.append(genException.getClassifierAccessorName());
766     stringBuffer.append(TEXT_210);
767     }
768     }
769     if (c.hasNext()) {
770     stringBuffer.append(TEXT_211);
771     }
772     }
773     }
774     if (!genPackage.getGenEnums().isEmpty()) {
775     stringBuffer.append(TEXT_212);
776     for (Iterator e=genPackage.getGenEnums().iterator(); e.hasNext();) { GenEnum genEnum = (GenEnum)e.next();
777     stringBuffer.append(TEXT_213);
778     stringBuffer.append(genEnum.getClassifierInstanceName());
779     stringBuffer.append(TEXT_214);
780     stringBuffer.append(genEnum.getImportedName());
781     stringBuffer.append(TEXT_215);
782     stringBuffer.append(genEnum.getName());
783     stringBuffer.append(TEXT_216);
784     stringBuffer.append(genModel.getNonNLS());
785     for (Iterator l=genEnum.getGenEnumLiterals().iterator(); l.hasNext();) { GenEnumLiteral genEnumLiteral = (GenEnumLiteral)l.next();
786     stringBuffer.append(TEXT_217);
787     stringBuffer.append(genEnum.getClassifierInstanceName());
788     stringBuffer.append(TEXT_218);
789     stringBuffer.append(genEnum.getImportedName().equals(genEnum.getClassifierID()) ? genEnum.getQualifiedName() : genEnum.getImportedName());
790     stringBuffer.append(TEXT_219);
791     stringBuffer.append(genEnumLiteral.getEnumLiteralID());
792     stringBuffer.append(TEXT_220);
793     }
794     if (e.hasNext()) {
795     stringBuffer.append(TEXT_221);
796     }
797     }
798     }
799     if (!genPackage.getGenDataTypes().isEmpty()) {
800     stringBuffer.append(TEXT_222);
801     for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next();
802     stringBuffer.append(TEXT_223);
803     stringBuffer.append(genDataType.getClassifierInstanceName());
804     stringBuffer.append(TEXT_224);
805     stringBuffer.append(genDataType.getImportedInstanceClassName());
806     stringBuffer.append(TEXT_225);
807     stringBuffer.append(genDataType.getName());
808     stringBuffer.append(TEXT_226);
809     stringBuffer.append(genDataType.getSerializableFlag());
810     stringBuffer.append(TEXT_227);
811     stringBuffer.append(genDataType.getGeneratedInstanceClassFlag());
812     stringBuffer.append(TEXT_228);
813     stringBuffer.append(genModel.getNonNLS());
814     }
815     }
816     if (genPackage.getSuperGenPackage() == null) {
817     stringBuffer.append(TEXT_229);
818     }
819     if (!genPackage.getAnnotationSources().isEmpty()) {
820     stringBuffer.append(TEXT_230);
821     for (Iterator i = genPackage.getAnnotationSources().iterator(); i.hasNext();) { String JavaDoc annotationSource = (String JavaDoc)i.next();
822     stringBuffer.append(TEXT_231);
823     stringBuffer.append(annotationSource);
824     stringBuffer.append(TEXT_232);
825     stringBuffer.append(genPackage.getAnnotationSourceIdentifier(annotationSource));
826     stringBuffer.append(TEXT_233);
827     }
828     }
829     stringBuffer.append(TEXT_234);
830     for (Iterator i = genPackage.getAnnotationSources().iterator(); i.hasNext();) { String JavaDoc annotationSource = (String JavaDoc)i.next();
831     stringBuffer.append(TEXT_235);
832     stringBuffer.append(annotationSource);
833     stringBuffer.append(TEXT_236);
834     stringBuffer.append(genPackage.getAnnotationSourceIdentifier(annotationSource));
835     stringBuffer.append(TEXT_237);
836     if (annotationSource == null) {
837     stringBuffer.append(TEXT_238);
838     } else {
839     stringBuffer.append(TEXT_239);
840     stringBuffer.append(annotationSource);
841     stringBuffer.append(TEXT_240);
842     stringBuffer.append(genModel.getNonNLS());
843     }
844     for (Iterator j = genPackage.getAllAnnotations().iterator(); j.hasNext();) { EAnnotation eAnnotation = (EAnnotation)j.next();
845     stringBuffer.append(TEXT_241);
846     if (annotationSource == null ? eAnnotation.getSource() == null : annotationSource.equals(eAnnotation.getSource())) {
847     stringBuffer.append(TEXT_242);
848     stringBuffer.append(genPackage.getAnnotatedModelElementAccessor(eAnnotation));
849     stringBuffer.append(TEXT_243);
850     for (Iterator k = eAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String JavaDoc key = Literals.toStringLiteral((String JavaDoc)detail.getKey(), genModel); String JavaDoc value = Literals.toStringLiteral((String JavaDoc)detail.getValue(), genModel);
851     stringBuffer.append(TEXT_244);
852     stringBuffer.append(key);
853     stringBuffer.append(TEXT_245);
854     stringBuffer.append(value);
855     stringBuffer.append(k.hasNext() ? "," : "");
856     stringBuffer.append(genModel.getNonNLS(key + value));
857     }
858     stringBuffer.append(TEXT_246);
859     }
860     }
861     stringBuffer.append(TEXT_247);
862     }
863     } else {
864     if (genPackage.isLoadingInitialization()) {
865     stringBuffer.append(TEXT_248);
866     stringBuffer.append(genModel.getImportedName("java.net.URL"));
867     stringBuffer.append(TEXT_249);
868     stringBuffer.append(genModel.getNonNLS());
869     stringBuffer.append(TEXT_250);
870     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.URI"));
871     stringBuffer.append(TEXT_251);
872     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.URI"));
873     stringBuffer.append(TEXT_252);
874     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.resource.Resource"));
875     stringBuffer.append(TEXT_253);
876     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl"));
877     stringBuffer.append(TEXT_254);
878     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.URI"));
879     stringBuffer.append(TEXT_255);
880     stringBuffer.append(genModel.getImportedName("java.io.IOException"));
881     stringBuffer.append(TEXT_256);
882     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.WrappedException"));
883     stringBuffer.append(TEXT_257);
884     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EPackage"));
885     stringBuffer.append(TEXT_258);
886     }
887     stringBuffer.append(TEXT_259);
888     }
889     stringBuffer.append(TEXT_260);
890     stringBuffer.append(genPackage.getPackageClassName());
891     genModel.emitSortedImports();
892     stringBuffer.append(TEXT_261);
893     return stringBuffer.toString();
894   }
895 }
896
Popular Tags