]>
Commit | Line | Data |
---|---|---|
55e83b18 | 1 | /** @file\r |
2 | \r | |
3 | The file is used to provide Find funtions in workspace\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.common.find;\r | |
16 | \r | |
17 | import java.util.Vector;\r | |
18 | \r | |
8b44bd1d | 19 | import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r |
419558bb | 20 | import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;\r |
55e83b18 | 21 | import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r |
22 | import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r | |
23 | import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r | |
d12f87d3 | 24 | import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;\r |
8b44bd1d | 25 | import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;\r |
26 | import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;\r | |
55e83b18 | 27 | import org.tianocore.frameworkwizard.common.DataType;\r |
28 | import org.tianocore.frameworkwizard.common.GlobalData;\r | |
29 | import org.tianocore.frameworkwizard.common.Sort;\r | |
30 | import org.tianocore.frameworkwizard.common.Tools;\r | |
31 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r | |
32 | import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;\r | |
33 | import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;\r | |
34 | import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;\r | |
35 | import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r | |
36 | import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;\r | |
37 | import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;\r | |
38 | import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;\r | |
39 | import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;\r | |
40 | import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;\r | |
41 | import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;\r | |
42 | import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r | |
43 | \r | |
44 | public class Find {\r | |
45 | \r | |
46 | private final static String SEPERATOR = ".";\r | |
47 | \r | |
48 | /**\r | |
49 | Get all ppi entries from workspace\r | |
50 | \r | |
51 | @return\r | |
52 | \r | |
53 | **/\r | |
54 | public static PpisVector getAllPpisVector() {\r | |
55 | PpisVector pv = new PpisVector();\r | |
56 | ModuleSurfaceArea msa = null;\r | |
57 | ModuleIdentification mid = null;\r | |
58 | PpisIdentification pid = null;\r | |
59 | \r | |
60 | //\r | |
61 | // Go through each module one by one\r | |
62 | //\r | |
63 | if (GlobalData.openingModuleList.size() > 0) {\r | |
64 | for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r | |
65 | msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r | |
66 | mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r | |
67 | \r | |
68 | if (msa.getPPIs() != null) {\r | |
69 | if (msa.getPPIs().getPpiList().size() > 0) {\r | |
70 | for (int index = 0; index < msa.getPPIs().getPpiList().size(); index++) {\r | |
71 | String arg0 = msa.getPPIs().getPpiList().get(index).getPpiCName();\r | |
72 | String arg1 = DataType.PPI_TYPE_PPI;\r | |
73 | String arg2 = null;\r | |
74 | if (msa.getPPIs().getPpiList().get(index).getUsage() != null) {\r | |
75 | arg2 = msa.getPPIs().getPpiList().get(index).getUsage().toString();\r | |
76 | }\r | |
77 | \r | |
78 | String arg3 = msa.getPPIs().getPpiList().get(index).getFeatureFlag();\r | |
79 | Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiList().get(index)\r | |
80 | .getSupArchList());\r | |
81 | String arg5 = msa.getPPIs().getPpiList().get(index).getHelpText();\r | |
82 | \r | |
83 | pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
84 | pid.setBelongModule(mid);\r | |
85 | \r | |
86 | //\r | |
87 | // Find which package declares it\r | |
88 | //\r | |
89 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
90 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
91 | .getOpeningPackageByIndex(\r | |
92 | indexOfPackage)\r | |
93 | .getXmlSpd();\r | |
94 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
95 | .getOpeningPackageByIndex(\r | |
96 | indexOfPackage)\r | |
97 | .getId();\r | |
98 | if (spd.getPpiDeclarations() != null) {\r | |
99 | for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()\r | |
100 | .size(); indexOfPpis++) {\r | |
101 | if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()\r | |
102 | .equals(arg0)) {\r | |
103 | pid.setDeclaredBy(packageId);\r | |
104 | break;\r | |
105 | }\r | |
106 | }\r | |
107 | }\r | |
108 | }\r | |
109 | if (pid.getDeclaredBy() == null) {\r | |
110 | pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
111 | }\r | |
112 | \r | |
113 | pv.addPpis(pid);\r | |
114 | }\r | |
115 | }\r | |
116 | if (msa.getPPIs().getPpiNotifyList().size() > 0) {\r | |
117 | for (int index = 0; index < msa.getPPIs().getPpiNotifyList().size(); index++) {\r | |
118 | String arg0 = msa.getPPIs().getPpiNotifyList().get(index).getPpiNotifyCName();\r | |
119 | String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;\r | |
120 | String arg2 = null;\r | |
121 | if (msa.getPPIs().getPpiNotifyList().get(index).getUsage() != null) {\r | |
122 | arg2 = msa.getPPIs().getPpiNotifyList().get(index).getUsage().toString();\r | |
123 | }\r | |
124 | \r | |
125 | String arg3 = msa.getPPIs().getPpiNotifyList().get(index).getFeatureFlag();\r | |
126 | Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiNotifyList().get(index)\r | |
127 | .getSupArchList());\r | |
128 | String arg5 = msa.getPPIs().getPpiNotifyList().get(index).getHelpText();\r | |
129 | \r | |
130 | pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
131 | pid.setBelongModule(mid);\r | |
132 | \r | |
133 | //\r | |
134 | // Find which package declares it\r | |
135 | //\r | |
136 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
137 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
138 | .getOpeningPackageByIndex(\r | |
139 | indexOfPackage)\r | |
140 | .getXmlSpd();\r | |
141 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
142 | .getOpeningPackageByIndex(\r | |
143 | indexOfPackage)\r | |
144 | .getId();\r | |
145 | if (spd.getPpiDeclarations() != null) {\r | |
146 | for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()\r | |
147 | .size(); indexOfPpis++) {\r | |
148 | if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()\r | |
149 | .equals(arg0)) {\r | |
150 | pid.setDeclaredBy(packageId);\r | |
151 | break;\r | |
152 | }\r | |
153 | }\r | |
154 | }\r | |
155 | }\r | |
156 | if (pid.getDeclaredBy() == null) {\r | |
157 | pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
158 | }\r | |
159 | \r | |
160 | pv.addPpis(pid);\r | |
161 | }\r | |
162 | }\r | |
163 | }\r | |
164 | }\r | |
165 | }\r | |
8b44bd1d | 166 | //\r |
167 | // Go through all defined ppi to find which is not added yet.\r | |
168 | //\r | |
169 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
170 | PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r | |
171 | PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r | |
172 | .getId();\r | |
173 | if (spd.getPpiDeclarations() != null) {\r | |
174 | for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList().size(); indexOfPpis++) {\r | |
175 | boolean isFound = false;\r | |
176 | PpiDeclarations.Entry e = spd.getPpiDeclarations().getEntryList().get(indexOfPpis);\r | |
177 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
178 | if (e.getCName().equals(pv.getPpis(indexOfPv).getName())) {\r | |
179 | isFound = true;\r | |
180 | break;\r | |
181 | }\r | |
182 | }\r | |
183 | if (!isFound) {\r | |
184 | String arg0 = e.getCName();\r | |
185 | String arg1 = "";\r | |
186 | String arg2 = "";\r | |
187 | String arg3 = "";\r | |
188 | Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r | |
189 | String arg5 = e.getHelpText();\r | |
190 | \r | |
191 | pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
192 | pid.setBelongModule(null);\r | |
193 | pid.setDeclaredBy(packageId);\r | |
194 | pv.addPpis(pid);\r | |
195 | }\r | |
196 | }\r | |
197 | }\r | |
198 | }\r | |
55e83b18 | 199 | Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);\r |
200 | return pv;\r | |
201 | }\r | |
202 | \r | |
203 | /**\r | |
204 | Re-org all ppi entries for find table\r | |
205 | \r | |
206 | @return\r | |
207 | \r | |
208 | **/\r | |
209 | public static Vector<PpiId> getAllPpisForFind() {\r | |
210 | Vector<PpiId> ppi = new Vector<PpiId>();\r | |
211 | PpisVector pv = Find.getAllPpisVector();\r | |
212 | boolean isAdded = false;\r | |
213 | boolean isProduced = false;\r | |
214 | \r | |
215 | //\r | |
216 | // Go through pv to add item as new format to ppi one by one\r | |
217 | //\r | |
218 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
219 | isAdded = false;\r | |
220 | PpisIdentification pvId = pv.getPpis(indexOfPv);\r | |
221 | \r | |
222 | //\r | |
223 | // First check if produced or not\r | |
224 | //\r | |
225 | if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
226 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
227 | isProduced = true;\r | |
228 | } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r | |
229 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r | |
230 | isProduced = false;\r | |
231 | }\r | |
232 | \r | |
233 | //\r | |
234 | // Get the sting "PackageName.ModuleName" \r | |
235 | //\r | |
8b44bd1d | 236 | String tmp = "";\r |
237 | if (pvId.getBelongModule() != null) {\r | |
238 | tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r | |
239 | }\r | |
55e83b18 | 240 | \r |
241 | //\r | |
242 | // Check if the item has been added in\r | |
243 | // If added, append package name and new module name\r | |
244 | // If not added, add a new one first\r | |
245 | //\r | |
246 | for (int indexOfPpi = 0; indexOfPpi < ppi.size(); indexOfPpi++) {\r | |
247 | PpiId ppiId = ppi.get(indexOfPpi);\r | |
248 | \r | |
249 | if (pvId.getName().equals(ppiId.getName())) {\r | |
250 | if (isProduced) {\r | |
251 | ppi.get(indexOfPpi).setProducedModules(ppiId.getProducedModules() + "<br>" + tmp);\r | |
252 | } else if (!isProduced) {\r | |
253 | ppi.get(indexOfPpi).setConsumedModules(ppiId.getConsumedModules() + "<br>" + tmp);\r | |
254 | }\r | |
255 | isAdded = true;\r | |
256 | continue;\r | |
257 | }\r | |
258 | }\r | |
259 | \r | |
260 | //\r | |
261 | // Add a new one\r | |
262 | //\r | |
263 | if (!isAdded) {\r | |
264 | if (isProduced) {\r | |
265 | ppi\r | |
266 | .addElement(new PpiId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));\r | |
267 | } else if (!isProduced) {\r | |
268 | ppi\r | |
269 | .addElement(new PpiId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));\r | |
270 | }\r | |
271 | }\r | |
272 | }\r | |
273 | \r | |
274 | return ppi;\r | |
275 | }\r | |
276 | \r | |
277 | /**\r | |
278 | Get all protocol entries from workspace\r | |
279 | \r | |
280 | @return\r | |
281 | \r | |
282 | **/\r | |
283 | public static ProtocolsVector getAllProtocolsVector() {\r | |
284 | ProtocolsVector pv = new ProtocolsVector();\r | |
285 | ModuleSurfaceArea msa = null;\r | |
286 | ModuleIdentification mid = null;\r | |
287 | ProtocolsIdentification pid = null;\r | |
288 | \r | |
289 | //\r | |
290 | // Go through each module one by one\r | |
291 | //\r | |
292 | if (GlobalData.openingModuleList.size() > 0) {\r | |
293 | for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r | |
294 | msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r | |
295 | mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r | |
296 | \r | |
297 | if (msa.getProtocols() != null) {\r | |
298 | if (msa.getProtocols().getProtocolList().size() > 0) {\r | |
299 | for (int index = 0; index < msa.getProtocols().getProtocolList().size(); index++) {\r | |
300 | String arg0 = msa.getProtocols().getProtocolList().get(index).getProtocolCName();\r | |
301 | String arg1 = DataType.PROTOCOL_TYPE_PROTOCOL;\r | |
302 | String arg2 = null;\r | |
303 | if (msa.getProtocols().getProtocolList().get(index).getUsage() != null) {\r | |
304 | arg2 = msa.getProtocols().getProtocolList().get(index).getUsage().toString();\r | |
305 | }\r | |
306 | \r | |
307 | String arg3 = msa.getProtocols().getProtocolList().get(index).getFeatureFlag();\r | |
308 | Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolList()\r | |
309 | .get(index).getSupArchList());\r | |
310 | String arg5 = msa.getProtocols().getProtocolList().get(index).getHelpText();\r | |
311 | \r | |
312 | pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
313 | pid.setBelongModule(mid);\r | |
314 | \r | |
315 | //\r | |
316 | // Find which package declares it\r | |
317 | //\r | |
318 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
319 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
320 | .getOpeningPackageByIndex(\r | |
321 | indexOfPackage)\r | |
322 | .getXmlSpd();\r | |
323 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
324 | .getOpeningPackageByIndex(\r | |
325 | indexOfPackage)\r | |
326 | .getId();\r | |
327 | if (spd.getProtocolDeclarations() != null) {\r | |
328 | for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()\r | |
329 | .getEntryList().size(); indexOfProtocols++) {\r | |
330 | if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)\r | |
331 | .getCName().equals(arg0)) {\r | |
332 | pid.setDeclaredBy(packageId);\r | |
333 | break;\r | |
334 | }\r | |
335 | }\r | |
336 | }\r | |
337 | }\r | |
338 | if (pid.getDeclaredBy() == null) {\r | |
339 | pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
340 | }\r | |
341 | pv.addProtocols(pid);\r | |
342 | }\r | |
343 | }\r | |
344 | if (msa.getProtocols().getProtocolNotifyList().size() > 0) {\r | |
345 | for (int index = 0; index < msa.getProtocols().getProtocolNotifyList().size(); index++) {\r | |
346 | String arg0 = msa.getProtocols().getProtocolNotifyList().get(index)\r | |
347 | .getProtocolNotifyCName();\r | |
348 | String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;\r | |
349 | String arg2 = null;\r | |
350 | if (msa.getProtocols().getProtocolNotifyList().get(index).getUsage() != null) {\r | |
351 | arg2 = msa.getProtocols().getProtocolNotifyList().get(index).getUsage().toString();\r | |
352 | }\r | |
353 | \r | |
354 | String arg3 = msa.getProtocols().getProtocolNotifyList().get(index).getFeatureFlag();\r | |
355 | Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolNotifyList()\r | |
356 | .get(index).getSupArchList());\r | |
357 | String arg5 = msa.getProtocols().getProtocolNotifyList().get(index).getHelpText();\r | |
358 | \r | |
359 | pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
360 | pid.setBelongModule(mid);\r | |
361 | \r | |
362 | //\r | |
363 | // Find which package declares it\r | |
364 | //\r | |
365 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
366 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
367 | .getOpeningPackageByIndex(\r | |
368 | indexOfPackage)\r | |
369 | .getXmlSpd();\r | |
370 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
371 | .getOpeningPackageByIndex(\r | |
372 | indexOfPackage)\r | |
373 | .getId();\r | |
374 | if (spd.getProtocolDeclarations() != null) {\r | |
375 | for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()\r | |
376 | .getEntryList().size(); indexOfProtocols++) {\r | |
377 | if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)\r | |
378 | .getCName().equals(arg0)) {\r | |
379 | pid.setDeclaredBy(packageId);\r | |
380 | break;\r | |
381 | }\r | |
382 | }\r | |
383 | }\r | |
384 | }\r | |
385 | if (pid.getDeclaredBy() == null) {\r | |
386 | pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
387 | }\r | |
388 | \r | |
389 | pv.addProtocols(pid);\r | |
390 | }\r | |
391 | }\r | |
392 | }\r | |
393 | }\r | |
394 | }\r | |
8b44bd1d | 395 | //\r |
396 | // Go through all defined protocols to find which is not added yet.\r | |
397 | //\r | |
398 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
399 | PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r | |
400 | PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r | |
401 | .getId();\r | |
402 | if (spd.getProtocolDeclarations() != null) {\r | |
403 | for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations().getEntryList().size(); indexOfProtocols++) {\r | |
404 | boolean isFound = false;\r | |
405 | ProtocolDeclarations.Entry e = spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols);\r | |
406 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
407 | if (e.getCName().equals(pv.getProtocols(indexOfPv).getName())) {\r | |
408 | isFound = true;\r | |
409 | break;\r | |
410 | }\r | |
411 | }\r | |
412 | if (!isFound) {\r | |
413 | String arg0 = e.getCName();\r | |
414 | String arg1 = "";\r | |
415 | String arg2 = "";\r | |
416 | String arg3 = "";\r | |
417 | Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r | |
418 | String arg5 = e.getHelpText();\r | |
419 | \r | |
420 | pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r | |
421 | pid.setBelongModule(null);\r | |
422 | pid.setDeclaredBy(packageId);\r | |
423 | pv.addProtocols(pid);\r | |
424 | }\r | |
425 | }\r | |
426 | }\r | |
427 | }\r | |
55e83b18 | 428 | Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);\r |
429 | return pv;\r | |
430 | }\r | |
431 | \r | |
432 | /**\r | |
433 | Re-org all protocol entries for find table\r | |
434 | \r | |
435 | @return\r | |
436 | \r | |
437 | **/\r | |
438 | public static Vector<ProtocolId> getAllProtocolsForFind() {\r | |
439 | Vector<ProtocolId> protocol = new Vector<ProtocolId>();\r | |
440 | ProtocolsVector pv = Find.getAllProtocolsVector();\r | |
441 | boolean isAdded = false;\r | |
442 | boolean isProduced = false;\r | |
443 | \r | |
444 | //\r | |
445 | // Go through pv to add item as new format to ppi one by one\r | |
446 | //\r | |
447 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
448 | isAdded = false;\r | |
449 | ProtocolsIdentification pvId = pv.getProtocols(indexOfPv);\r | |
450 | \r | |
451 | //\r | |
452 | // First check if produced or not\r | |
453 | //\r | |
454 | if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
455 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
456 | isProduced = true;\r | |
457 | } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r | |
458 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r | |
459 | isProduced = false;\r | |
460 | }\r | |
461 | \r | |
462 | //\r | |
463 | // Get the sting "PackageName.ModuleName" \r | |
464 | //\r | |
8b44bd1d | 465 | String tmp = "";\r |
466 | if (pvId.getBelongModule() != null) {\r | |
467 | tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r | |
468 | }\r | |
55e83b18 | 469 | \r |
470 | //\r | |
471 | // Check if the item has been added in\r | |
472 | // If added, append package name and new module name\r | |
473 | // If not added, add a new one first\r | |
474 | //\r | |
475 | for (int indexOfProtocol = 0; indexOfProtocol < protocol.size(); indexOfProtocol++) {\r | |
476 | ProtocolId protocolId = protocol.get(indexOfProtocol);\r | |
477 | \r | |
478 | if (pvId.getName().equals(protocolId.getName())) {\r | |
479 | if (isProduced) {\r | |
480 | protocol.get(indexOfProtocol)\r | |
481 | .setProducedModules(protocolId.getProducedModules() + "<br>" + tmp);\r | |
482 | } else if (!isProduced) {\r | |
483 | protocol.get(indexOfProtocol)\r | |
484 | .setConsumedModules(protocolId.getConsumedModules() + "<br>" + tmp);\r | |
485 | }\r | |
486 | isAdded = true;\r | |
487 | continue;\r | |
488 | }\r | |
489 | }\r | |
490 | \r | |
491 | //\r | |
492 | // Add a new one\r | |
493 | //\r | |
494 | if (!isAdded) {\r | |
495 | if (isProduced) {\r | |
496 | protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy()\r | |
497 | .getName()));\r | |
498 | } else if (!isProduced) {\r | |
499 | protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy()\r | |
500 | .getName()));\r | |
501 | }\r | |
502 | }\r | |
503 | }\r | |
504 | \r | |
505 | return protocol;\r | |
506 | }\r | |
507 | \r | |
508 | /**\r | |
509 | Get all protocol entries from workspace\r | |
510 | \r | |
511 | @return\r | |
512 | \r | |
513 | **/\r | |
514 | public static GuidsVector getAllGuidsVector() {\r | |
515 | GuidsVector gv = new GuidsVector();\r | |
516 | ModuleSurfaceArea msa = null;\r | |
517 | ModuleIdentification mid = null;\r | |
518 | GuidsIdentification gid = null;\r | |
519 | \r | |
520 | //\r | |
521 | // Go through each module one by one\r | |
522 | //\r | |
523 | if (GlobalData.openingModuleList.size() > 0) {\r | |
524 | for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r | |
525 | msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r | |
526 | mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r | |
527 | \r | |
528 | if (msa.getGuids() != null) {\r | |
529 | if (msa.getGuids().getGuidCNamesList().size() > 0) {\r | |
530 | for (int index = 0; index < msa.getGuids().getGuidCNamesList().size(); index++) {\r | |
531 | String arg0 = msa.getGuids().getGuidCNamesList().get(index).getGuidCName();\r | |
532 | String arg1 = null;\r | |
533 | if (msa.getGuids().getGuidCNamesList().get(index).getUsage() != null) {\r | |
534 | arg1 = msa.getGuids().getGuidCNamesList().get(index).getUsage().toString();\r | |
535 | }\r | |
536 | \r | |
537 | String arg2 = msa.getGuids().getGuidCNamesList().get(index).getFeatureFlag();\r | |
538 | Vector<String> arg3 = Tools.convertListToVector(msa.getGuids().getGuidCNamesList()\r | |
539 | .get(index).getSupArchList());\r | |
540 | String arg4 = msa.getGuids().getGuidCNamesList().get(index).getHelpText();\r | |
541 | \r | |
542 | gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);\r | |
543 | gid.setBelongModule(mid);\r | |
544 | \r | |
545 | //\r | |
546 | // Find which package declares it\r | |
547 | //\r | |
548 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
549 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
550 | .getOpeningPackageByIndex(\r | |
551 | indexOfPackage)\r | |
552 | .getXmlSpd();\r | |
553 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
554 | .getOpeningPackageByIndex(\r | |
555 | indexOfPackage)\r | |
556 | .getId();\r | |
557 | if (spd.getGuidDeclarations() != null) {\r | |
558 | for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList()\r | |
559 | .size(); indexOfGuids++) {\r | |
560 | if (spd.getGuidDeclarations().getEntryList().get(indexOfGuids).getCName()\r | |
561 | .equals(arg0)) {\r | |
562 | gid.setDeclaredBy(packageId);\r | |
563 | break;\r | |
564 | }\r | |
565 | }\r | |
566 | }\r | |
567 | }\r | |
568 | if (gid.getDeclaredBy() == null) {\r | |
569 | gid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
570 | }\r | |
571 | \r | |
572 | gv.addGuids(gid);\r | |
573 | }\r | |
574 | }\r | |
575 | }\r | |
576 | }\r | |
577 | }\r | |
8b44bd1d | 578 | //\r |
579 | // Go through all defined guids to find which is not added yet.\r | |
580 | //\r | |
581 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
582 | PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r | |
583 | PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r | |
584 | .getId();\r | |
585 | if (spd.getGuidDeclarations() != null) {\r | |
586 | for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList().size(); indexOfGuids++) {\r | |
587 | boolean isFound = false;\r | |
588 | GuidDeclarations.Entry e = spd.getGuidDeclarations().getEntryList().get(indexOfGuids);\r | |
589 | for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {\r | |
590 | if (e.getCName().equals(gv.getGuids(indexOfGv).getName())) {\r | |
591 | isFound = true;\r | |
592 | break;\r | |
593 | }\r | |
594 | }\r | |
595 | if (!isFound) {\r | |
596 | String arg0 = e.getCName();\r | |
597 | String arg1 = "";\r | |
598 | String arg2 = "";\r | |
599 | Vector<String> arg3 = Tools.convertListToVector(e.getSupArchList());\r | |
600 | String arg4 = e.getHelpText();\r | |
601 | \r | |
602 | gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);\r | |
603 | gid.setBelongModule(null);\r | |
604 | gid.setDeclaredBy(packageId);\r | |
605 | gv.addGuids(gid);\r | |
606 | }\r | |
607 | }\r | |
608 | }\r | |
609 | }\r | |
55e83b18 | 610 | Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);\r |
611 | return gv;\r | |
612 | }\r | |
613 | \r | |
614 | /**\r | |
615 | Re-org all guid entries for find table\r | |
616 | \r | |
617 | @return\r | |
618 | \r | |
619 | **/\r | |
620 | public static Vector<GuidId> getAllGuidsForFind() {\r | |
621 | Vector<GuidId> guid = new Vector<GuidId>();\r | |
622 | GuidsVector gv = Find.getAllGuidsVector();\r | |
623 | boolean isAdded = false;\r | |
624 | boolean isProduced = false;\r | |
625 | \r | |
626 | //\r | |
627 | // Go through pv to add item as new format to ppi one by one\r | |
628 | //\r | |
629 | for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {\r | |
630 | isAdded = false;\r | |
631 | GuidsIdentification gvId = gv.getGuids(indexOfGv);\r | |
632 | \r | |
633 | //\r | |
634 | // First check if produced or not\r | |
635 | //\r | |
636 | if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
637 | || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
638 | isProduced = true;\r | |
639 | } else if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r | |
640 | || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r | |
641 | isProduced = false;\r | |
642 | }\r | |
643 | \r | |
644 | //\r | |
645 | // Get the sting "PackageName.ModuleName" \r | |
646 | //\r | |
8b44bd1d | 647 | String tmp = "";\r |
648 | if (gvId.getBelongModule() != null) {\r | |
649 | tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();\r | |
650 | }\r | |
55e83b18 | 651 | \r |
652 | //\r | |
653 | // Check if the item has been added in\r | |
654 | // If added, append package name and new module name\r | |
655 | // If not added, add a new one first\r | |
656 | //\r | |
657 | for (int indexOfGuid = 0; indexOfGuid < guid.size(); indexOfGuid++) {\r | |
658 | GuidId guidId = guid.get(indexOfGuid);\r | |
659 | \r | |
660 | if (gvId.getName().equals(guidId.getName())) {\r | |
661 | if (isProduced) {\r | |
662 | guid.get(indexOfGuid).setProducedModules(guidId.getProducedModules() + "<br>" + tmp);\r | |
663 | } else if (!isProduced) {\r | |
664 | guid.get(indexOfGuid).setConsumedModules(guidId.getConsumedModules() + "<br>" + tmp);\r | |
665 | }\r | |
666 | isAdded = true;\r | |
667 | continue;\r | |
668 | }\r | |
669 | }\r | |
670 | \r | |
671 | //\r | |
672 | // Add a new one\r | |
673 | //\r | |
674 | if (!isAdded) {\r | |
675 | if (isProduced) {\r | |
676 | guid.addElement(new GuidId(gvId.getName(), "GUID", tmp, null, gvId.getDeclaredBy().getName()));\r | |
677 | } else if (!isProduced) {\r | |
678 | guid.addElement(new GuidId(gvId.getName(), "GUID", null, tmp, gvId.getDeclaredBy().getName()));\r | |
679 | }\r | |
680 | }\r | |
681 | }\r | |
682 | \r | |
683 | return guid;\r | |
684 | }\r | |
685 | \r | |
686 | /**\r | |
687 | Get all pcd coded entries from workspace\r | |
688 | \r | |
689 | @return\r | |
690 | \r | |
691 | **/\r | |
692 | public static PcdCodedVector getAllPcdCodedVector() {\r | |
693 | PcdCodedVector pv = new PcdCodedVector();\r | |
694 | ModuleSurfaceArea msa = null;\r | |
695 | ModuleIdentification mid = null;\r | |
696 | PcdCodedIdentification pid = null;\r | |
697 | \r | |
698 | //\r | |
699 | // Go through each module one by one\r | |
700 | //\r | |
701 | if (GlobalData.openingModuleList.size() > 0) {\r | |
702 | for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r | |
703 | msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r | |
704 | mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r | |
705 | \r | |
706 | if (msa.getPcdCoded() != null) {\r | |
707 | if (msa.getPcdCoded().getPcdEntryList().size() > 0) {\r | |
708 | for (int index = 0; index < msa.getPcdCoded().getPcdEntryList().size(); index++) {\r | |
709 | \r | |
710 | String arg0 = msa.getPcdCoded().getPcdEntryList().get(index).getCName();\r | |
711 | String arg1 = msa.getPcdCoded().getPcdEntryList().get(index).getTokenSpaceGuidCName();\r | |
712 | \r | |
713 | String arg2 = msa.getPcdCoded().getPcdEntryList().get(index).getFeatureFlag();\r | |
714 | Vector<String> arg3 = Tools.convertListToVector(msa.getPcdCoded().getPcdEntryList()\r | |
715 | .get(index).getSupArchList());\r | |
716 | \r | |
717 | String arg4 = msa.getPcdCoded().getPcdEntryList().get(index).getDefaultValue();\r | |
718 | String arg5 = msa.getPcdCoded().getPcdEntryList().get(index).getHelpText();\r | |
719 | String arg6 = null;\r | |
720 | if (msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType() != null) {\r | |
721 | arg6 = msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType().toString();\r | |
722 | }\r | |
723 | String arg7 = null;\r | |
724 | if (msa.getPcdCoded().getPcdEntryList().get(index).getUsage() != null) {\r | |
725 | arg7 = msa.getPcdCoded().getPcdEntryList().get(index).getUsage().toString();\r | |
726 | }\r | |
727 | pid = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\r | |
728 | pid.setBelongModule(mid);\r | |
729 | \r | |
730 | //\r | |
731 | // Find which package declares it\r | |
732 | //\r | |
733 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
734 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
735 | .getOpeningPackageByIndex(\r | |
736 | indexOfPackage)\r | |
737 | .getXmlSpd();\r | |
738 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
739 | .getOpeningPackageByIndex(\r | |
740 | indexOfPackage)\r | |
741 | .getId();\r | |
742 | if (spd.getPcdDeclarations() != null) {\r | |
743 | for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()\r | |
744 | .size(); indexOfPcds++) {\r | |
d12f87d3 | 745 | PcdEntry pcdEntry = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);\r |
746 | if (pcdEntry.getCName().equals(arg0)) {\r | |
747 | pid.setTokenSpaceGuidCName(pcdEntry.getTokenSpaceGuidCName());\r | |
748 | pid.setToken(pcdEntry.getToken().toString());\r | |
749 | pid.setDatumType(pcdEntry.getDatumType().toString());\r | |
750 | pid.setValue(pcdEntry.getDefaultValue());\r | |
751 | pid.setUsage(Tools.convertListToString(pcdEntry.getValidUsage()));\r | |
752 | pid.setHelp(pcdEntry.getHelpText());\r | |
55e83b18 | 753 | pid.setDeclaredBy(packageId);\r |
754 | break;\r | |
755 | }\r | |
756 | }\r | |
757 | }\r | |
758 | }\r | |
759 | if (pid.getDeclaredBy() == null) {\r | |
760 | pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
761 | }\r | |
762 | \r | |
763 | pv.addPcdCoded(pid);\r | |
764 | }\r | |
765 | }\r | |
766 | }\r | |
767 | }\r | |
768 | }\r | |
8b44bd1d | 769 | //\r |
770 | // Go through all defined pcds to find which is not added yet.\r | |
771 | //\r | |
772 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
773 | PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r | |
774 | PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r | |
775 | .getId();\r | |
776 | if (spd.getPcdDeclarations() != null) {\r | |
777 | for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds++) {\r | |
778 | boolean isFound = false;\r | |
779 | PcdEntry e = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);\r | |
780 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
781 | if (e.getCName().equals(pv.getPcdCoded(indexOfPv).getName())) {\r | |
782 | isFound = true;\r | |
783 | break;\r | |
784 | }\r | |
785 | }\r | |
786 | if (!isFound) {\r | |
787 | pid = new PcdCodedIdentification("", "", "", null, "", "", null, null);\r | |
788 | pid.setName(e.getCName());\r | |
789 | pid.setTokenSpaceGuidCName(e.getTokenSpaceGuidCName());\r | |
790 | pid.setToken(e.getToken().toString());\r | |
791 | pid.setDatumType(e.getDatumType().toString());\r | |
792 | pid.setValue(e.getDefaultValue());\r | |
793 | pid.setUsage(Tools.convertListToString(e.getValidUsage()));\r | |
794 | pid.setHelp(e.getHelpText());\r | |
795 | pid.setDeclaredBy(packageId);\r | |
796 | \r | |
797 | pid.setBelongModule(null);\r | |
798 | pv.addPcdCoded(pid);\r | |
799 | }\r | |
800 | }\r | |
801 | }\r | |
802 | }\r | |
55e83b18 | 803 | Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);\r |
804 | return pv;\r | |
805 | }\r | |
806 | \r | |
807 | /**\r | |
55e83b18 | 808 | \r |
8b44bd1d | 809 | @param pv\r |
55e83b18 | 810 | @return\r |
811 | \r | |
812 | **/\r | |
8b44bd1d | 813 | public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {\r |
d12f87d3 | 814 | Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();\r |
55e83b18 | 815 | boolean isAdded = false;\r |
816 | boolean isProduced = false;\r | |
817 | \r | |
818 | //\r | |
819 | // Go through pv to add item as new format to ppi one by one\r | |
820 | //\r | |
821 | for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r | |
822 | isAdded = false;\r | |
823 | PcdCodedIdentification pvId = pv.getPcdCoded(indexOfPv);\r | |
824 | \r | |
825 | //\r | |
826 | // First check if produced or not\r | |
827 | //\r | |
828 | if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
829 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
830 | isProduced = true;\r | |
831 | } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r | |
832 | || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r | |
833 | isProduced = false;\r | |
834 | }\r | |
835 | \r | |
55e83b18 | 836 | //\r |
837 | // Check if the item has been added in\r | |
838 | // If added, append package name and new module name\r | |
839 | // If not added, add a new one first\r | |
840 | //\r | |
841 | for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {\r | |
d12f87d3 | 842 | PcdFindResultId pcdId = pcd.get(indexOfGuid);\r |
55e83b18 | 843 | \r |
844 | if (pvId.getName().equals(pcdId.getName())) {\r | |
845 | if (isProduced) {\r | |
d12f87d3 | 846 | pcd.get(indexOfGuid).addProducedModules(pvId.getBelongModule());\r |
55e83b18 | 847 | } else if (!isProduced) {\r |
d12f87d3 | 848 | pcd.get(indexOfGuid).addConsumedModules(pvId.getBelongModule());\r |
55e83b18 | 849 | }\r |
850 | isAdded = true;\r | |
851 | continue;\r | |
852 | }\r | |
853 | }\r | |
854 | \r | |
855 | //\r | |
856 | // Add a new one\r | |
857 | //\r | |
858 | if (!isAdded) {\r | |
d12f87d3 | 859 | PcdFindResultId pcdId = new PcdFindResultId(pvId.getName(), "PCD", pvId.getSupArchList(),\r |
860 | pvId.getHelp(), null, pvId.getDeclaredBy());\r | |
861 | pcdId.setTokenSpaceGuidCName(pvId.getTokenSpaceGuidCName());\r | |
862 | pcdId.setToken(pvId.getToken());\r | |
863 | pcdId.setDatumType(pvId.getDatumType());\r | |
864 | pcdId.setValue(pvId.getValue());\r | |
865 | pcdId.setUsage(pvId.getUsage());\r | |
8b44bd1d | 866 | \r |
d12f87d3 | 867 | pcd.addElement(pcdId);\r |
55e83b18 | 868 | }\r |
869 | }\r | |
870 | \r | |
871 | return pcd;\r | |
872 | }\r | |
8b44bd1d | 873 | \r |
55e83b18 | 874 | /**\r |
875 | Get all library class entries from workspace\r | |
876 | \r | |
877 | @return\r | |
878 | \r | |
879 | **/\r | |
880 | public static LibraryClassVector getAllLibraryClassVector() {\r | |
881 | LibraryClassVector lcv = new LibraryClassVector();\r | |
882 | ModuleSurfaceArea msa = null;\r | |
883 | ModuleIdentification mid = null;\r | |
884 | LibraryClassIdentification lcid = null;\r | |
885 | \r | |
886 | //\r | |
887 | // Go through each module one by one\r | |
888 | //\r | |
889 | if (GlobalData.openingModuleList.size() > 0) {\r | |
890 | for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r | |
891 | msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r | |
892 | mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r | |
893 | \r | |
894 | if (msa.getLibraryClassDefinitions() != null) {\r | |
895 | LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();\r | |
896 | if (lcd.getLibraryClassList().size() > 0) {\r | |
897 | for (int index = 0; index < lcd.getLibraryClassList().size(); index++) {\r | |
898 | String name = lcd.getLibraryClassList().get(index).getKeyword();\r | |
899 | String usage = null;\r | |
900 | if (lcd.getLibraryClassList().get(index).getUsage() != null) {\r | |
901 | usage = lcd.getLibraryClassList().get(index).getUsage().toString();\r | |
902 | }\r | |
903 | String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();\r | |
904 | String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();\r | |
905 | String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();\r | |
906 | Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)\r | |
907 | .getSupArchList());\r | |
908 | Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)\r | |
909 | .getSupModuleList());\r | |
910 | String help = lcd.getLibraryClassList().get(index).getHelpText();\r | |
911 | lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag,\r | |
912 | module, help);\r | |
913 | lcid.setBelongModule(mid);\r | |
914 | \r | |
915 | //\r | |
916 | // Find which package declares it\r | |
917 | //\r | |
918 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
919 | PackageSurfaceArea spd = GlobalData.openingPackageList\r | |
920 | .getOpeningPackageByIndex(\r | |
921 | indexOfPackage)\r | |
922 | .getXmlSpd();\r | |
923 | PackageIdentification packageId = GlobalData.openingPackageList\r | |
924 | .getOpeningPackageByIndex(\r | |
925 | indexOfPackage)\r | |
926 | .getId();\r | |
927 | if (spd.getLibraryClassDeclarations() != null) {\r | |
928 | for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd\r | |
929 | .getLibraryClassDeclarations()\r | |
930 | .getLibraryClassList()\r | |
931 | .size(); indexOfLibraryClass++) {\r | |
d12f87d3 | 932 | LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList()\r |
933 | .get(indexOfLibraryClass);\r | |
419558bb | 934 | if (lc.getName().equals(name)) {\r |
935 | lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r | |
936 | lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r | |
937 | lcid.setHelp(lc.getHelpText());\r | |
55e83b18 | 938 | lcid.setDeclaredBy(packageId);\r |
939 | break;\r | |
940 | }\r | |
941 | }\r | |
942 | }\r | |
943 | }\r | |
944 | if (lcid.getDeclaredBy() == null) {\r | |
945 | lcid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r | |
946 | }\r | |
947 | \r | |
948 | lcv.addLibraryClass(lcid);\r | |
949 | }\r | |
950 | }\r | |
951 | }\r | |
952 | }\r | |
953 | }\r | |
8b44bd1d | 954 | //\r |
955 | // Go through all defined pcds to find which is not added yet.\r | |
956 | //\r | |
957 | for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r | |
958 | PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r | |
959 | PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r | |
960 | .getId();\r | |
961 | if (spd.getLibraryClassDeclarations() != null) {\r | |
962 | for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd.getLibraryClassDeclarations()\r | |
963 | .getLibraryClassList().size(); indexOfLibraryClass++) {\r | |
964 | boolean isFound = false;\r | |
965 | LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);\r | |
966 | for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r | |
967 | if (lc.getName().equals(lcv.getLibraryClass(indexOfLcv).getLibraryClassName())) {\r | |
968 | isFound = true;\r | |
969 | break;\r | |
970 | }\r | |
971 | }\r | |
972 | if (!isFound) {\r | |
973 | lcid = new LibraryClassIdentification("", null, "", "", null, "", null, "");\r | |
974 | lcid.setLibraryClassName(lc.getName());\r | |
975 | lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r | |
976 | lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r | |
977 | lcid.setHelp(lc.getHelpText());\r | |
978 | lcid.setDeclaredBy(packageId);\r | |
979 | \r | |
980 | lcid.setBelongModule(null);\r | |
981 | lcv.addLibraryClass(lcid);\r | |
982 | }\r | |
983 | }\r | |
984 | }\r | |
985 | }\r | |
55e83b18 | 986 | Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);\r |
987 | return lcv;\r | |
988 | }\r | |
989 | \r | |
990 | /**\r | |
991 | Re-org all guid entries for find table\r | |
992 | \r | |
993 | @return\r | |
994 | \r | |
995 | **/\r | |
419558bb | 996 | public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {\r |
997 | Vector<FindResultId> libraryClass = new Vector<FindResultId>();\r | |
55e83b18 | 998 | boolean isAdded = false;\r |
999 | boolean isProduced = false;\r | |
1000 | \r | |
1001 | //\r | |
1002 | // Go through pv to add item as new format to ppi one by one\r | |
1003 | //\r | |
1004 | for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r | |
1005 | isAdded = false;\r | |
1006 | LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);\r | |
1007 | \r | |
1008 | //\r | |
1009 | // First check if produced or not\r | |
1010 | //\r | |
1011 | if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r | |
1012 | || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r | |
1013 | isProduced = true;\r | |
1014 | } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r | |
1015 | || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r | |
1016 | isProduced = false;\r | |
1017 | }\r | |
1018 | \r | |
55e83b18 | 1019 | //\r |
1020 | // Check if the item has been added in\r | |
1021 | // If added, append package name and new module name\r | |
1022 | // If not added, add a new one first\r | |
1023 | //\r | |
1024 | for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {\r | |
419558bb | 1025 | FindResultId frId = libraryClass.get(indexOfGuid);\r |
55e83b18 | 1026 | \r |
419558bb | 1027 | if (lcvId.getLibraryClassName().equals(frId.getName())) {\r |
55e83b18 | 1028 | if (isProduced) {\r |
419558bb | 1029 | libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());\r |
55e83b18 | 1030 | } else if (!isProduced) {\r |
419558bb | 1031 | libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());\r |
55e83b18 | 1032 | }\r |
1033 | isAdded = true;\r | |
1034 | continue;\r | |
1035 | }\r | |
1036 | }\r | |
1037 | \r | |
1038 | //\r | |
1039 | // Add a new one\r | |
1040 | //\r | |
1041 | if (!isAdded) {\r | |
419558bb | 1042 | libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",\r |
1043 | lcvId.getSupArchList(), lcvId.getHelp(),\r | |
1044 | lcvId.getSupModuleList(), lcvId.getDeclaredBy()));\r | |
55e83b18 | 1045 | }\r |
1046 | }\r | |
1047 | \r | |
1048 | return libraryClass;\r | |
1049 | }\r | |
1050 | }\r |