3 The file is used to provide Find funtions in workspace
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.common
.find
;
17 import java
.util
.Vector
;
19 import org
.tianocore
.LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
;
20 import org
.tianocore
.LibraryClassDefinitionsDocument
.LibraryClassDefinitions
;
21 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
22 import org
.tianocore
.PackageSurfaceAreaDocument
.PackageSurfaceArea
;
23 import org
.tianocore
.PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
;
24 import org
.tianocore
.frameworkwizard
.common
.DataType
;
25 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
26 import org
.tianocore
.frameworkwizard
.common
.Sort
;
27 import org
.tianocore
.frameworkwizard
.common
.Tools
;
28 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
29 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsIdentification
;
30 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsVector
;
31 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassIdentification
;
32 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassVector
;
33 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedIdentification
;
34 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedVector
;
35 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisIdentification
;
36 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisVector
;
37 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsIdentification
;
38 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsVector
;
39 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
43 private final static String SEPERATOR
= ".";
46 Get all ppi entries from workspace
51 public static PpisVector
getAllPpisVector() {
52 PpisVector pv
= new PpisVector();
53 ModuleSurfaceArea msa
= null;
54 ModuleIdentification mid
= null;
55 PpisIdentification pid
= null;
58 // Go through each module one by one
60 if (GlobalData
.openingModuleList
.size() > 0) {
61 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
62 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
63 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
65 if (msa
.getPPIs() != null) {
66 if (msa
.getPPIs().getPpiList().size() > 0) {
67 for (int index
= 0; index
< msa
.getPPIs().getPpiList().size(); index
++) {
68 String arg0
= msa
.getPPIs().getPpiList().get(index
).getPpiCName();
69 String arg1
= DataType
.PPI_TYPE_PPI
;
71 if (msa
.getPPIs().getPpiList().get(index
).getUsage() != null) {
72 arg2
= msa
.getPPIs().getPpiList().get(index
).getUsage().toString();
75 String arg3
= msa
.getPPIs().getPpiList().get(index
).getFeatureFlag();
76 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiList().get(index
)
78 String arg5
= msa
.getPPIs().getPpiList().get(index
).getHelpText();
80 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
81 pid
.setBelongModule(mid
);
84 // Find which package declares it
86 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
87 PackageSurfaceArea spd
= GlobalData
.openingPackageList
88 .getOpeningPackageByIndex(
91 PackageIdentification packageId
= GlobalData
.openingPackageList
92 .getOpeningPackageByIndex(
95 if (spd
.getPpiDeclarations() != null) {
96 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
97 .size(); indexOfPpis
++) {
98 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
100 pid
.setDeclaredBy(packageId
);
106 if (pid
.getDeclaredBy() == null) {
107 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
113 if (msa
.getPPIs().getPpiNotifyList().size() > 0) {
114 for (int index
= 0; index
< msa
.getPPIs().getPpiNotifyList().size(); index
++) {
115 String arg0
= msa
.getPPIs().getPpiNotifyList().get(index
).getPpiNotifyCName();
116 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
118 if (msa
.getPPIs().getPpiNotifyList().get(index
).getUsage() != null) {
119 arg2
= msa
.getPPIs().getPpiNotifyList().get(index
).getUsage().toString();
122 String arg3
= msa
.getPPIs().getPpiNotifyList().get(index
).getFeatureFlag();
123 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiNotifyList().get(index
)
125 String arg5
= msa
.getPPIs().getPpiNotifyList().get(index
).getHelpText();
127 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
128 pid
.setBelongModule(mid
);
131 // Find which package declares it
133 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
134 PackageSurfaceArea spd
= GlobalData
.openingPackageList
135 .getOpeningPackageByIndex(
138 PackageIdentification packageId
= GlobalData
.openingPackageList
139 .getOpeningPackageByIndex(
142 if (spd
.getPpiDeclarations() != null) {
143 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
144 .size(); indexOfPpis
++) {
145 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
147 pid
.setDeclaredBy(packageId
);
153 if (pid
.getDeclaredBy() == null) {
154 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
163 Sort
.sortPpis(pv
, DataType
.SORT_TYPE_ASCENDING
);
168 Re-org all ppi entries for find table
173 public static Vector
<PpiId
> getAllPpisForFind() {
174 Vector
<PpiId
> ppi
= new Vector
<PpiId
>();
175 PpisVector pv
= Find
.getAllPpisVector();
176 boolean isAdded
= false;
177 boolean isProduced
= false;
180 // Go through pv to add item as new format to ppi one by one
182 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
184 PpisIdentification pvId
= pv
.getPpis(indexOfPv
);
187 // First check if produced or not
189 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
190 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
192 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
193 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
198 // Get the sting "PackageName.ModuleName"
200 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
203 // Check if the item has been added in
204 // If added, append package name and new module name
205 // If not added, add a new one first
207 for (int indexOfPpi
= 0; indexOfPpi
< ppi
.size(); indexOfPpi
++) {
208 PpiId ppiId
= ppi
.get(indexOfPpi
);
210 if (pvId
.getName().equals(ppiId
.getName())) {
212 ppi
.get(indexOfPpi
).setProducedModules(ppiId
.getProducedModules() + "<br>" + tmp
);
213 } else if (!isProduced
) {
214 ppi
.get(indexOfPpi
).setConsumedModules(ppiId
.getConsumedModules() + "<br>" + tmp
);
227 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
228 } else if (!isProduced
) {
230 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
239 Get all protocol entries from workspace
244 public static ProtocolsVector
getAllProtocolsVector() {
245 ProtocolsVector pv
= new ProtocolsVector();
246 ModuleSurfaceArea msa
= null;
247 ModuleIdentification mid
= null;
248 ProtocolsIdentification pid
= null;
251 // Go through each module one by one
253 if (GlobalData
.openingModuleList
.size() > 0) {
254 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
255 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
256 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
258 if (msa
.getProtocols() != null) {
259 if (msa
.getProtocols().getProtocolList().size() > 0) {
260 for (int index
= 0; index
< msa
.getProtocols().getProtocolList().size(); index
++) {
261 String arg0
= msa
.getProtocols().getProtocolList().get(index
).getProtocolCName();
262 String arg1
= DataType
.PROTOCOL_TYPE_PROTOCOL
;
264 if (msa
.getProtocols().getProtocolList().get(index
).getUsage() != null) {
265 arg2
= msa
.getProtocols().getProtocolList().get(index
).getUsage().toString();
268 String arg3
= msa
.getProtocols().getProtocolList().get(index
).getFeatureFlag();
269 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolList()
270 .get(index
).getSupArchList());
271 String arg5
= msa
.getProtocols().getProtocolList().get(index
).getHelpText();
273 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
274 pid
.setBelongModule(mid
);
277 // Find which package declares it
279 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
280 PackageSurfaceArea spd
= GlobalData
.openingPackageList
281 .getOpeningPackageByIndex(
284 PackageIdentification packageId
= GlobalData
.openingPackageList
285 .getOpeningPackageByIndex(
288 if (spd
.getProtocolDeclarations() != null) {
289 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
290 .getEntryList().size(); indexOfProtocols
++) {
291 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
292 .getCName().equals(arg0
)) {
293 pid
.setDeclaredBy(packageId
);
299 if (pid
.getDeclaredBy() == null) {
300 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
302 pv
.addProtocols(pid
);
305 if (msa
.getProtocols().getProtocolNotifyList().size() > 0) {
306 for (int index
= 0; index
< msa
.getProtocols().getProtocolNotifyList().size(); index
++) {
307 String arg0
= msa
.getProtocols().getProtocolNotifyList().get(index
)
308 .getProtocolNotifyCName();
309 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
311 if (msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage() != null) {
312 arg2
= msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage().toString();
315 String arg3
= msa
.getProtocols().getProtocolNotifyList().get(index
).getFeatureFlag();
316 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolNotifyList()
317 .get(index
).getSupArchList());
318 String arg5
= msa
.getProtocols().getProtocolNotifyList().get(index
).getHelpText();
320 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
321 pid
.setBelongModule(mid
);
324 // Find which package declares it
326 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
327 PackageSurfaceArea spd
= GlobalData
.openingPackageList
328 .getOpeningPackageByIndex(
331 PackageIdentification packageId
= GlobalData
.openingPackageList
332 .getOpeningPackageByIndex(
335 if (spd
.getProtocolDeclarations() != null) {
336 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
337 .getEntryList().size(); indexOfProtocols
++) {
338 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
339 .getCName().equals(arg0
)) {
340 pid
.setDeclaredBy(packageId
);
346 if (pid
.getDeclaredBy() == null) {
347 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
350 pv
.addProtocols(pid
);
356 Sort
.sortProtocols(pv
, DataType
.SORT_TYPE_ASCENDING
);
361 Re-org all protocol entries for find table
366 public static Vector
<ProtocolId
> getAllProtocolsForFind() {
367 Vector
<ProtocolId
> protocol
= new Vector
<ProtocolId
>();
368 ProtocolsVector pv
= Find
.getAllProtocolsVector();
369 boolean isAdded
= false;
370 boolean isProduced
= false;
373 // Go through pv to add item as new format to ppi one by one
375 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
377 ProtocolsIdentification pvId
= pv
.getProtocols(indexOfPv
);
380 // First check if produced or not
382 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
383 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
385 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
386 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
391 // Get the sting "PackageName.ModuleName"
393 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
396 // Check if the item has been added in
397 // If added, append package name and new module name
398 // If not added, add a new one first
400 for (int indexOfProtocol
= 0; indexOfProtocol
< protocol
.size(); indexOfProtocol
++) {
401 ProtocolId protocolId
= protocol
.get(indexOfProtocol
);
403 if (pvId
.getName().equals(protocolId
.getName())) {
405 protocol
.get(indexOfProtocol
)
406 .setProducedModules(protocolId
.getProducedModules() + "<br>" + tmp
);
407 } else if (!isProduced
) {
408 protocol
.get(indexOfProtocol
)
409 .setConsumedModules(protocolId
.getConsumedModules() + "<br>" + tmp
);
421 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy()
423 } else if (!isProduced
) {
424 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy()
434 Get all protocol entries from workspace
439 public static GuidsVector
getAllGuidsVector() {
440 GuidsVector gv
= new GuidsVector();
441 ModuleSurfaceArea msa
= null;
442 ModuleIdentification mid
= null;
443 GuidsIdentification gid
= null;
446 // Go through each module one by one
448 if (GlobalData
.openingModuleList
.size() > 0) {
449 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
450 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
451 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
453 if (msa
.getGuids() != null) {
454 if (msa
.getGuids().getGuidCNamesList().size() > 0) {
455 for (int index
= 0; index
< msa
.getGuids().getGuidCNamesList().size(); index
++) {
456 String arg0
= msa
.getGuids().getGuidCNamesList().get(index
).getGuidCName();
458 if (msa
.getGuids().getGuidCNamesList().get(index
).getUsage() != null) {
459 arg1
= msa
.getGuids().getGuidCNamesList().get(index
).getUsage().toString();
462 String arg2
= msa
.getGuids().getGuidCNamesList().get(index
).getFeatureFlag();
463 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getGuids().getGuidCNamesList()
464 .get(index
).getSupArchList());
465 String arg4
= msa
.getGuids().getGuidCNamesList().get(index
).getHelpText();
467 gid
= new GuidsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
);
468 gid
.setBelongModule(mid
);
471 // Find which package declares it
473 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
474 PackageSurfaceArea spd
= GlobalData
.openingPackageList
475 .getOpeningPackageByIndex(
478 PackageIdentification packageId
= GlobalData
.openingPackageList
479 .getOpeningPackageByIndex(
482 if (spd
.getGuidDeclarations() != null) {
483 for (int indexOfGuids
= 0; indexOfGuids
< spd
.getGuidDeclarations().getEntryList()
484 .size(); indexOfGuids
++) {
485 if (spd
.getGuidDeclarations().getEntryList().get(indexOfGuids
).getCName()
487 gid
.setDeclaredBy(packageId
);
493 if (gid
.getDeclaredBy() == null) {
494 gid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
503 Sort
.sortGuids(gv
, DataType
.SORT_TYPE_ASCENDING
);
508 Re-org all guid entries for find table
513 public static Vector
<GuidId
> getAllGuidsForFind() {
514 Vector
<GuidId
> guid
= new Vector
<GuidId
>();
515 GuidsVector gv
= Find
.getAllGuidsVector();
516 boolean isAdded
= false;
517 boolean isProduced
= false;
520 // Go through pv to add item as new format to ppi one by one
522 for (int indexOfGv
= 0; indexOfGv
< gv
.size(); indexOfGv
++) {
524 GuidsIdentification gvId
= gv
.getGuids(indexOfGv
);
527 // First check if produced or not
529 if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
530 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
532 } else if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
533 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
538 // Get the sting "PackageName.ModuleName"
540 String tmp
= gvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ gvId
.getBelongModule().getName();
543 // Check if the item has been added in
544 // If added, append package name and new module name
545 // If not added, add a new one first
547 for (int indexOfGuid
= 0; indexOfGuid
< guid
.size(); indexOfGuid
++) {
548 GuidId guidId
= guid
.get(indexOfGuid
);
550 if (gvId
.getName().equals(guidId
.getName())) {
552 guid
.get(indexOfGuid
).setProducedModules(guidId
.getProducedModules() + "<br>" + tmp
);
553 } else if (!isProduced
) {
554 guid
.get(indexOfGuid
).setConsumedModules(guidId
.getConsumedModules() + "<br>" + tmp
);
566 guid
.addElement(new GuidId(gvId
.getName(), "GUID", tmp
, null, gvId
.getDeclaredBy().getName()));
567 } else if (!isProduced
) {
568 guid
.addElement(new GuidId(gvId
.getName(), "GUID", null, tmp
, gvId
.getDeclaredBy().getName()));
577 Get all pcd coded entries from workspace
582 public static PcdCodedVector
getAllPcdCodedVector() {
583 PcdCodedVector pv
= new PcdCodedVector();
584 ModuleSurfaceArea msa
= null;
585 ModuleIdentification mid
= null;
586 PcdCodedIdentification pid
= null;
589 // Go through each module one by one
591 if (GlobalData
.openingModuleList
.size() > 0) {
592 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
593 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
594 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
596 if (msa
.getPcdCoded() != null) {
597 if (msa
.getPcdCoded().getPcdEntryList().size() > 0) {
598 for (int index
= 0; index
< msa
.getPcdCoded().getPcdEntryList().size(); index
++) {
600 String arg0
= msa
.getPcdCoded().getPcdEntryList().get(index
).getCName();
601 String arg1
= msa
.getPcdCoded().getPcdEntryList().get(index
).getTokenSpaceGuidCName();
603 String arg2
= msa
.getPcdCoded().getPcdEntryList().get(index
).getFeatureFlag();
604 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getPcdCoded().getPcdEntryList()
605 .get(index
).getSupArchList());
607 String arg4
= msa
.getPcdCoded().getPcdEntryList().get(index
).getDefaultValue();
608 String arg5
= msa
.getPcdCoded().getPcdEntryList().get(index
).getHelpText();
610 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType() != null) {
611 arg6
= msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType().toString();
614 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage() != null) {
615 arg7
= msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage().toString();
617 pid
= new PcdCodedIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, arg7
);
618 pid
.setBelongModule(mid
);
621 // Find which package declares it
623 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
624 PackageSurfaceArea spd
= GlobalData
.openingPackageList
625 .getOpeningPackageByIndex(
628 PackageIdentification packageId
= GlobalData
.openingPackageList
629 .getOpeningPackageByIndex(
632 if (spd
.getPcdDeclarations() != null) {
633 for (int indexOfPcds
= 0; indexOfPcds
< spd
.getPcdDeclarations().getPcdEntryList()
634 .size(); indexOfPcds
++) {
635 PcdEntry pcdEntry
= spd
.getPcdDeclarations().getPcdEntryList().get(indexOfPcds
);
636 if (pcdEntry
.getCName().equals(arg0
)) {
637 pid
.setTokenSpaceGuidCName(pcdEntry
.getTokenSpaceGuidCName());
638 pid
.setToken(pcdEntry
.getToken().toString());
639 pid
.setDatumType(pcdEntry
.getDatumType().toString());
640 pid
.setValue(pcdEntry
.getDefaultValue());
641 pid
.setUsage(Tools
.convertListToString(pcdEntry
.getValidUsage()));
642 pid
.setHelp(pcdEntry
.getHelpText());
643 pid
.setDeclaredBy(packageId
);
649 if (pid
.getDeclaredBy() == null) {
650 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
659 Sort
.sortPcdCodeds(pv
, DataType
.SORT_TYPE_ASCENDING
);
664 Re-org all guid entries for find table
684 public static Vector
<PcdFindResultId
> getAllPcdCodedForFind(PcdCodedVector pv
) {
685 Vector
<PcdFindResultId
> pcd
= new Vector
<PcdFindResultId
>();
686 boolean isAdded
= false;
687 boolean isProduced
= false;
690 // Go through pv to add item as new format to ppi one by one
692 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
694 PcdCodedIdentification pvId
= pv
.getPcdCoded(indexOfPv
);
697 // First check if produced or not
699 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
700 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
702 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
703 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
708 // Check if the item has been added in
709 // If added, append package name and new module name
710 // If not added, add a new one first
712 for (int indexOfGuid
= 0; indexOfGuid
< pcd
.size(); indexOfGuid
++) {
713 PcdFindResultId pcdId
= pcd
.get(indexOfGuid
);
715 if (pvId
.getName().equals(pcdId
.getName())) {
717 pcd
.get(indexOfGuid
).addProducedModules(pvId
.getBelongModule());
718 } else if (!isProduced
) {
719 pcd
.get(indexOfGuid
).addConsumedModules(pvId
.getBelongModule());
730 PcdFindResultId pcdId
= new PcdFindResultId(pvId
.getName(), "PCD", pvId
.getSupArchList(),
731 pvId
.getHelp(), null, pvId
.getDeclaredBy());
732 pcdId
.setTokenSpaceGuidCName(pvId
.getTokenSpaceGuidCName());
733 pcdId
.setToken(pvId
.getToken());
734 pcdId
.setDatumType(pvId
.getDatumType());
735 pcdId
.setValue(pvId
.getValue());
736 pcdId
.setUsage(pvId
.getUsage());
738 pcd
.addElement(pcdId
);
745 Get all library class entries from workspace
750 public static LibraryClassVector
getAllLibraryClassVector() {
751 LibraryClassVector lcv
= new LibraryClassVector();
752 ModuleSurfaceArea msa
= null;
753 ModuleIdentification mid
= null;
754 LibraryClassIdentification lcid
= null;
757 // Go through each module one by one
759 if (GlobalData
.openingModuleList
.size() > 0) {
760 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
761 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
762 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
764 if (msa
.getLibraryClassDefinitions() != null) {
765 LibraryClassDefinitions lcd
= msa
.getLibraryClassDefinitions();
766 if (lcd
.getLibraryClassList().size() > 0) {
767 for (int index
= 0; index
< lcd
.getLibraryClassList().size(); index
++) {
768 String name
= lcd
.getLibraryClassList().get(index
).getKeyword();
770 if (lcd
.getLibraryClassList().get(index
).getUsage() != null) {
771 usage
= lcd
.getLibraryClassList().get(index
).getUsage().toString();
773 String version
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceVersion();
774 String guid
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceGuid();
775 String featureFlag
= lcd
.getLibraryClassList().get(index
).getFeatureFlag();
776 Vector
<String
> arch
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
778 Vector
<String
> module
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
779 .getSupModuleList());
780 String help
= lcd
.getLibraryClassList().get(index
).getHelpText();
781 lcid
= new LibraryClassIdentification(name
, usage
, version
, guid
, arch
, featureFlag
,
783 lcid
.setBelongModule(mid
);
786 // Find which package declares it
788 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
789 PackageSurfaceArea spd
= GlobalData
.openingPackageList
790 .getOpeningPackageByIndex(
793 PackageIdentification packageId
= GlobalData
.openingPackageList
794 .getOpeningPackageByIndex(
797 if (spd
.getLibraryClassDeclarations() != null) {
798 for (int indexOfLibraryClass
= 0; indexOfLibraryClass
< spd
799 .getLibraryClassDeclarations()
800 .getLibraryClassList()
801 .size(); indexOfLibraryClass
++) {
802 LibraryClass lc
= spd
.getLibraryClassDeclarations().getLibraryClassList()
803 .get(indexOfLibraryClass
);
804 if (lc
.getName().equals(name
)) {
805 lcid
.setSupArchList(Tools
.convertListToVector(lc
.getSupArchList()));
806 lcid
.setSupModuleList(Tools
.convertListToVector(lc
.getSupModuleList()));
807 lcid
.setHelp(lc
.getHelpText());
808 lcid
.setDeclaredBy(packageId
);
814 if (lcid
.getDeclaredBy() == null) {
815 lcid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
818 lcv
.addLibraryClass(lcid
);
824 Sort
.sortLibraryClass(lcv
, DataType
.SORT_TYPE_ASCENDING
);
829 Re-org all guid entries for find table
834 public static Vector
<FindResultId
> getAllLibraryClassForFind(LibraryClassVector lcv
) {
835 Vector
<FindResultId
> libraryClass
= new Vector
<FindResultId
>();
836 boolean isAdded
= false;
837 boolean isProduced
= false;
840 // Go through pv to add item as new format to ppi one by one
842 for (int indexOfLcv
= 0; indexOfLcv
< lcv
.size(); indexOfLcv
++) {
844 LibraryClassIdentification lcvId
= lcv
.getLibraryClass(indexOfLcv
);
847 // First check if produced or not
849 if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
850 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
852 } else if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
853 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
858 // Check if the item has been added in
859 // If added, append package name and new module name
860 // If not added, add a new one first
862 for (int indexOfGuid
= 0; indexOfGuid
< libraryClass
.size(); indexOfGuid
++) {
863 FindResultId frId
= libraryClass
.get(indexOfGuid
);
865 if (lcvId
.getLibraryClassName().equals(frId
.getName())) {
867 libraryClass
.get(indexOfGuid
).addProducedModules(lcvId
.getBelongModule());
868 } else if (!isProduced
) {
869 libraryClass
.get(indexOfGuid
).addConsumedModules(lcvId
.getBelongModule());
880 libraryClass
.addElement(new FindResultId(lcvId
.getLibraryClassName(), "Library Class",
881 lcvId
.getSupArchList(), lcvId
.getHelp(),
882 lcvId
.getSupModuleList(), lcvId
.getDeclaredBy()));