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
.frameworkwizard
.common
.DataType
;
24 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
25 import org
.tianocore
.frameworkwizard
.common
.Sort
;
26 import org
.tianocore
.frameworkwizard
.common
.Tools
;
27 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
28 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsIdentification
;
29 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsVector
;
30 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassIdentification
;
31 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassVector
;
32 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedIdentification
;
33 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedVector
;
34 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisIdentification
;
35 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisVector
;
36 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsIdentification
;
37 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsVector
;
38 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
42 private final static String SEPERATOR
= ".";
45 Get all ppi entries from workspace
50 public static PpisVector
getAllPpisVector() {
51 PpisVector pv
= new PpisVector();
52 ModuleSurfaceArea msa
= null;
53 ModuleIdentification mid
= null;
54 PpisIdentification pid
= null;
57 // Go through each module one by one
59 if (GlobalData
.openingModuleList
.size() > 0) {
60 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
61 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
62 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
64 if (msa
.getPPIs() != null) {
65 if (msa
.getPPIs().getPpiList().size() > 0) {
66 for (int index
= 0; index
< msa
.getPPIs().getPpiList().size(); index
++) {
67 String arg0
= msa
.getPPIs().getPpiList().get(index
).getPpiCName();
68 String arg1
= DataType
.PPI_TYPE_PPI
;
70 if (msa
.getPPIs().getPpiList().get(index
).getUsage() != null) {
71 arg2
= msa
.getPPIs().getPpiList().get(index
).getUsage().toString();
74 String arg3
= msa
.getPPIs().getPpiList().get(index
).getFeatureFlag();
75 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiList().get(index
)
77 String arg5
= msa
.getPPIs().getPpiList().get(index
).getHelpText();
79 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
80 pid
.setBelongModule(mid
);
83 // Find which package declares it
85 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
86 PackageSurfaceArea spd
= GlobalData
.openingPackageList
87 .getOpeningPackageByIndex(
90 PackageIdentification packageId
= GlobalData
.openingPackageList
91 .getOpeningPackageByIndex(
94 if (spd
.getPpiDeclarations() != null) {
95 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
96 .size(); indexOfPpis
++) {
97 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
99 pid
.setDeclaredBy(packageId
);
105 if (pid
.getDeclaredBy() == null) {
106 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
112 if (msa
.getPPIs().getPpiNotifyList().size() > 0) {
113 for (int index
= 0; index
< msa
.getPPIs().getPpiNotifyList().size(); index
++) {
114 String arg0
= msa
.getPPIs().getPpiNotifyList().get(index
).getPpiNotifyCName();
115 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
117 if (msa
.getPPIs().getPpiNotifyList().get(index
).getUsage() != null) {
118 arg2
= msa
.getPPIs().getPpiNotifyList().get(index
).getUsage().toString();
121 String arg3
= msa
.getPPIs().getPpiNotifyList().get(index
).getFeatureFlag();
122 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiNotifyList().get(index
)
124 String arg5
= msa
.getPPIs().getPpiNotifyList().get(index
).getHelpText();
126 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
127 pid
.setBelongModule(mid
);
130 // Find which package declares it
132 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
133 PackageSurfaceArea spd
= GlobalData
.openingPackageList
134 .getOpeningPackageByIndex(
137 PackageIdentification packageId
= GlobalData
.openingPackageList
138 .getOpeningPackageByIndex(
141 if (spd
.getPpiDeclarations() != null) {
142 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
143 .size(); indexOfPpis
++) {
144 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
146 pid
.setDeclaredBy(packageId
);
152 if (pid
.getDeclaredBy() == null) {
153 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
162 Sort
.sortPpis(pv
, DataType
.SORT_TYPE_ASCENDING
);
167 Re-org all ppi entries for find table
172 public static Vector
<PpiId
> getAllPpisForFind() {
173 Vector
<PpiId
> ppi
= new Vector
<PpiId
>();
174 PpisVector pv
= Find
.getAllPpisVector();
175 boolean isAdded
= false;
176 boolean isProduced
= false;
179 // Go through pv to add item as new format to ppi one by one
181 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
183 PpisIdentification pvId
= pv
.getPpis(indexOfPv
);
186 // First check if produced or not
188 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
189 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
191 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
192 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
197 // Get the sting "PackageName.ModuleName"
199 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
202 // Check if the item has been added in
203 // If added, append package name and new module name
204 // If not added, add a new one first
206 for (int indexOfPpi
= 0; indexOfPpi
< ppi
.size(); indexOfPpi
++) {
207 PpiId ppiId
= ppi
.get(indexOfPpi
);
209 if (pvId
.getName().equals(ppiId
.getName())) {
211 ppi
.get(indexOfPpi
).setProducedModules(ppiId
.getProducedModules() + "<br>" + tmp
);
212 } else if (!isProduced
) {
213 ppi
.get(indexOfPpi
).setConsumedModules(ppiId
.getConsumedModules() + "<br>" + tmp
);
226 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
227 } else if (!isProduced
) {
229 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
238 Get all protocol entries from workspace
243 public static ProtocolsVector
getAllProtocolsVector() {
244 ProtocolsVector pv
= new ProtocolsVector();
245 ModuleSurfaceArea msa
= null;
246 ModuleIdentification mid
= null;
247 ProtocolsIdentification pid
= null;
250 // Go through each module one by one
252 if (GlobalData
.openingModuleList
.size() > 0) {
253 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
254 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
255 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
257 if (msa
.getProtocols() != null) {
258 if (msa
.getProtocols().getProtocolList().size() > 0) {
259 for (int index
= 0; index
< msa
.getProtocols().getProtocolList().size(); index
++) {
260 String arg0
= msa
.getProtocols().getProtocolList().get(index
).getProtocolCName();
261 String arg1
= DataType
.PROTOCOL_TYPE_PROTOCOL
;
263 if (msa
.getProtocols().getProtocolList().get(index
).getUsage() != null) {
264 arg2
= msa
.getProtocols().getProtocolList().get(index
).getUsage().toString();
267 String arg3
= msa
.getProtocols().getProtocolList().get(index
).getFeatureFlag();
268 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolList()
269 .get(index
).getSupArchList());
270 String arg5
= msa
.getProtocols().getProtocolList().get(index
).getHelpText();
272 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
273 pid
.setBelongModule(mid
);
276 // Find which package declares it
278 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
279 PackageSurfaceArea spd
= GlobalData
.openingPackageList
280 .getOpeningPackageByIndex(
283 PackageIdentification packageId
= GlobalData
.openingPackageList
284 .getOpeningPackageByIndex(
287 if (spd
.getProtocolDeclarations() != null) {
288 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
289 .getEntryList().size(); indexOfProtocols
++) {
290 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
291 .getCName().equals(arg0
)) {
292 pid
.setDeclaredBy(packageId
);
298 if (pid
.getDeclaredBy() == null) {
299 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
301 pv
.addProtocols(pid
);
304 if (msa
.getProtocols().getProtocolNotifyList().size() > 0) {
305 for (int index
= 0; index
< msa
.getProtocols().getProtocolNotifyList().size(); index
++) {
306 String arg0
= msa
.getProtocols().getProtocolNotifyList().get(index
)
307 .getProtocolNotifyCName();
308 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
310 if (msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage() != null) {
311 arg2
= msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage().toString();
314 String arg3
= msa
.getProtocols().getProtocolNotifyList().get(index
).getFeatureFlag();
315 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolNotifyList()
316 .get(index
).getSupArchList());
317 String arg5
= msa
.getProtocols().getProtocolNotifyList().get(index
).getHelpText();
319 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
320 pid
.setBelongModule(mid
);
323 // Find which package declares it
325 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
326 PackageSurfaceArea spd
= GlobalData
.openingPackageList
327 .getOpeningPackageByIndex(
330 PackageIdentification packageId
= GlobalData
.openingPackageList
331 .getOpeningPackageByIndex(
334 if (spd
.getProtocolDeclarations() != null) {
335 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
336 .getEntryList().size(); indexOfProtocols
++) {
337 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
338 .getCName().equals(arg0
)) {
339 pid
.setDeclaredBy(packageId
);
345 if (pid
.getDeclaredBy() == null) {
346 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
349 pv
.addProtocols(pid
);
355 Sort
.sortProtocols(pv
, DataType
.SORT_TYPE_ASCENDING
);
360 Re-org all protocol entries for find table
365 public static Vector
<ProtocolId
> getAllProtocolsForFind() {
366 Vector
<ProtocolId
> protocol
= new Vector
<ProtocolId
>();
367 ProtocolsVector pv
= Find
.getAllProtocolsVector();
368 boolean isAdded
= false;
369 boolean isProduced
= false;
372 // Go through pv to add item as new format to ppi one by one
374 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
376 ProtocolsIdentification pvId
= pv
.getProtocols(indexOfPv
);
379 // First check if produced or not
381 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
382 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
384 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
385 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
390 // Get the sting "PackageName.ModuleName"
392 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
395 // Check if the item has been added in
396 // If added, append package name and new module name
397 // If not added, add a new one first
399 for (int indexOfProtocol
= 0; indexOfProtocol
< protocol
.size(); indexOfProtocol
++) {
400 ProtocolId protocolId
= protocol
.get(indexOfProtocol
);
402 if (pvId
.getName().equals(protocolId
.getName())) {
404 protocol
.get(indexOfProtocol
)
405 .setProducedModules(protocolId
.getProducedModules() + "<br>" + tmp
);
406 } else if (!isProduced
) {
407 protocol
.get(indexOfProtocol
)
408 .setConsumedModules(protocolId
.getConsumedModules() + "<br>" + tmp
);
420 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy()
422 } else if (!isProduced
) {
423 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy()
433 Get all protocol entries from workspace
438 public static GuidsVector
getAllGuidsVector() {
439 GuidsVector gv
= new GuidsVector();
440 ModuleSurfaceArea msa
= null;
441 ModuleIdentification mid
= null;
442 GuidsIdentification gid
= null;
445 // Go through each module one by one
447 if (GlobalData
.openingModuleList
.size() > 0) {
448 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
449 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
450 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
452 if (msa
.getGuids() != null) {
453 if (msa
.getGuids().getGuidCNamesList().size() > 0) {
454 for (int index
= 0; index
< msa
.getGuids().getGuidCNamesList().size(); index
++) {
455 String arg0
= msa
.getGuids().getGuidCNamesList().get(index
).getGuidCName();
457 if (msa
.getGuids().getGuidCNamesList().get(index
).getUsage() != null) {
458 arg1
= msa
.getGuids().getGuidCNamesList().get(index
).getUsage().toString();
461 String arg2
= msa
.getGuids().getGuidCNamesList().get(index
).getFeatureFlag();
462 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getGuids().getGuidCNamesList()
463 .get(index
).getSupArchList());
464 String arg4
= msa
.getGuids().getGuidCNamesList().get(index
).getHelpText();
466 gid
= new GuidsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
);
467 gid
.setBelongModule(mid
);
470 // Find which package declares it
472 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
473 PackageSurfaceArea spd
= GlobalData
.openingPackageList
474 .getOpeningPackageByIndex(
477 PackageIdentification packageId
= GlobalData
.openingPackageList
478 .getOpeningPackageByIndex(
481 if (spd
.getGuidDeclarations() != null) {
482 for (int indexOfGuids
= 0; indexOfGuids
< spd
.getGuidDeclarations().getEntryList()
483 .size(); indexOfGuids
++) {
484 if (spd
.getGuidDeclarations().getEntryList().get(indexOfGuids
).getCName()
486 gid
.setDeclaredBy(packageId
);
492 if (gid
.getDeclaredBy() == null) {
493 gid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
502 Sort
.sortGuids(gv
, DataType
.SORT_TYPE_ASCENDING
);
507 Re-org all guid entries for find table
512 public static Vector
<GuidId
> getAllGuidsForFind() {
513 Vector
<GuidId
> guid
= new Vector
<GuidId
>();
514 GuidsVector gv
= Find
.getAllGuidsVector();
515 boolean isAdded
= false;
516 boolean isProduced
= false;
519 // Go through pv to add item as new format to ppi one by one
521 for (int indexOfGv
= 0; indexOfGv
< gv
.size(); indexOfGv
++) {
523 GuidsIdentification gvId
= gv
.getGuids(indexOfGv
);
526 // First check if produced or not
528 if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
529 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
531 } else if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
532 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
537 // Get the sting "PackageName.ModuleName"
539 String tmp
= gvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ gvId
.getBelongModule().getName();
542 // Check if the item has been added in
543 // If added, append package name and new module name
544 // If not added, add a new one first
546 for (int indexOfGuid
= 0; indexOfGuid
< guid
.size(); indexOfGuid
++) {
547 GuidId guidId
= guid
.get(indexOfGuid
);
549 if (gvId
.getName().equals(guidId
.getName())) {
551 guid
.get(indexOfGuid
).setProducedModules(guidId
.getProducedModules() + "<br>" + tmp
);
552 } else if (!isProduced
) {
553 guid
.get(indexOfGuid
).setConsumedModules(guidId
.getConsumedModules() + "<br>" + tmp
);
565 guid
.addElement(new GuidId(gvId
.getName(), "GUID", tmp
, null, gvId
.getDeclaredBy().getName()));
566 } else if (!isProduced
) {
567 guid
.addElement(new GuidId(gvId
.getName(), "GUID", null, tmp
, gvId
.getDeclaredBy().getName()));
576 Get all pcd coded entries from workspace
581 public static PcdCodedVector
getAllPcdCodedVector() {
582 PcdCodedVector pv
= new PcdCodedVector();
583 ModuleSurfaceArea msa
= null;
584 ModuleIdentification mid
= null;
585 PcdCodedIdentification pid
= null;
588 // Go through each module one by one
590 if (GlobalData
.openingModuleList
.size() > 0) {
591 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
592 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
593 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
595 if (msa
.getPcdCoded() != null) {
596 if (msa
.getPcdCoded().getPcdEntryList().size() > 0) {
597 for (int index
= 0; index
< msa
.getPcdCoded().getPcdEntryList().size(); index
++) {
599 String arg0
= msa
.getPcdCoded().getPcdEntryList().get(index
).getCName();
600 String arg1
= msa
.getPcdCoded().getPcdEntryList().get(index
).getTokenSpaceGuidCName();
602 String arg2
= msa
.getPcdCoded().getPcdEntryList().get(index
).getFeatureFlag();
603 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getPcdCoded().getPcdEntryList()
604 .get(index
).getSupArchList());
606 String arg4
= msa
.getPcdCoded().getPcdEntryList().get(index
).getDefaultValue();
607 String arg5
= msa
.getPcdCoded().getPcdEntryList().get(index
).getHelpText();
609 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType() != null) {
610 arg6
= msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType().toString();
613 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage() != null) {
614 arg7
= msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage().toString();
616 pid
= new PcdCodedIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, arg7
);
617 pid
.setBelongModule(mid
);
620 // Find which package declares it
622 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
623 PackageSurfaceArea spd
= GlobalData
.openingPackageList
624 .getOpeningPackageByIndex(
627 PackageIdentification packageId
= GlobalData
.openingPackageList
628 .getOpeningPackageByIndex(
631 if (spd
.getPcdDeclarations() != null) {
632 for (int indexOfPcds
= 0; indexOfPcds
< spd
.getPcdDeclarations().getPcdEntryList()
633 .size(); indexOfPcds
++) {
634 if (spd
.getPcdDeclarations().getPcdEntryList().get(indexOfPcds
).getCName()
636 pid
.setDeclaredBy(packageId
);
642 if (pid
.getDeclaredBy() == null) {
643 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
652 Sort
.sortPcdCodeds(pv
, DataType
.SORT_TYPE_ASCENDING
);
657 Re-org all guid entries for find table
662 public static Vector
<PcdId
> getAllPcdCodedForFind() {
663 Vector
<PcdId
> pcd
= new Vector
<PcdId
>();
664 PcdCodedVector pv
= Find
.getAllPcdCodedVector();
665 boolean isAdded
= false;
666 boolean isProduced
= false;
669 // Go through pv to add item as new format to ppi one by one
671 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
673 PcdCodedIdentification pvId
= pv
.getPcdCoded(indexOfPv
);
676 // First check if produced or not
678 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
679 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
681 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
682 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
687 // Get the sting "PackageName.ModuleName"
689 String tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
692 // Check if the item has been added in
693 // If added, append package name and new module name
694 // If not added, add a new one first
696 for (int indexOfGuid
= 0; indexOfGuid
< pcd
.size(); indexOfGuid
++) {
697 PcdId pcdId
= pcd
.get(indexOfGuid
);
699 if (pvId
.getName().equals(pcdId
.getName())) {
701 pcd
.get(indexOfGuid
).setProducedModules(pcdId
.getProducedModules() + "<br>" + tmp
);
702 } else if (!isProduced
) {
703 pcd
.get(indexOfGuid
).setConsumedModules(pcdId
.getConsumedModules() + "<br>" + tmp
);
716 .addElement(new PcdId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
717 } else if (!isProduced
) {
719 .addElement(new PcdId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
728 Get all library class entries from workspace
733 public static LibraryClassVector
getAllLibraryClassVector() {
734 LibraryClassVector lcv
= new LibraryClassVector();
735 ModuleSurfaceArea msa
= null;
736 ModuleIdentification mid
= null;
737 LibraryClassIdentification lcid
= null;
740 // Go through each module one by one
742 if (GlobalData
.openingModuleList
.size() > 0) {
743 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
744 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
745 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
747 if (msa
.getLibraryClassDefinitions() != null) {
748 LibraryClassDefinitions lcd
= msa
.getLibraryClassDefinitions();
749 if (lcd
.getLibraryClassList().size() > 0) {
750 for (int index
= 0; index
< lcd
.getLibraryClassList().size(); index
++) {
751 String name
= lcd
.getLibraryClassList().get(index
).getKeyword();
753 if (lcd
.getLibraryClassList().get(index
).getUsage() != null) {
754 usage
= lcd
.getLibraryClassList().get(index
).getUsage().toString();
756 String version
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceVersion();
757 String guid
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceGuid();
758 String featureFlag
= lcd
.getLibraryClassList().get(index
).getFeatureFlag();
759 Vector
<String
> arch
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
761 Vector
<String
> module
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
762 .getSupModuleList());
763 String help
= lcd
.getLibraryClassList().get(index
).getHelpText();
764 lcid
= new LibraryClassIdentification(name
, usage
, version
, guid
, arch
, featureFlag
,
766 lcid
.setBelongModule(mid
);
769 // Find which package declares it
771 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
772 PackageSurfaceArea spd
= GlobalData
.openingPackageList
773 .getOpeningPackageByIndex(
776 PackageIdentification packageId
= GlobalData
.openingPackageList
777 .getOpeningPackageByIndex(
780 if (spd
.getLibraryClassDeclarations() != null) {
781 for (int indexOfLibraryClass
= 0; indexOfLibraryClass
< spd
782 .getLibraryClassDeclarations()
783 .getLibraryClassList()
784 .size(); indexOfLibraryClass
++) {
785 LibraryClass lc
= spd
.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass
);
786 if (lc
.getName().equals(name
)) {
787 lcid
.setSupArchList(Tools
.convertListToVector(lc
.getSupArchList()));
788 lcid
.setSupModuleList(Tools
.convertListToVector(lc
.getSupModuleList()));
789 lcid
.setHelp(lc
.getHelpText());
790 lcid
.setDeclaredBy(packageId
);
796 if (lcid
.getDeclaredBy() == null) {
797 lcid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
800 lcv
.addLibraryClass(lcid
);
806 Sort
.sortLibraryClass(lcv
, DataType
.SORT_TYPE_ASCENDING
);
811 Re-org all guid entries for find table
816 // public static Vector<LibraryClassId> getAllLibraryClassForFind(LibraryClassVector lcv) {
817 // Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
818 // boolean isAdded = false;
819 // boolean isProduced = false;
822 // // Go through pv to add item as new format to ppi one by one
824 // for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
826 // LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);
829 // // First check if produced or not
831 // if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
832 // || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
833 // isProduced = true;
834 // } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
835 // || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
836 // isProduced = false;
840 // // Get the string "PackageName.ModuleName"
842 // String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
843 // + lcvId.getBelongModule().getName();
846 // // Check if the item has been added in
847 // // If added, append package name and new module name
848 // // If not added, add a new one first
850 // for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
851 // LibraryClassId lcId = libraryClass.get(indexOfGuid);
853 // if (lcvId.getLibraryClassName().equals(lcId.getName())) {
855 // libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);
856 // } else if (!isProduced) {
857 // libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);
869 // libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,
870 // lcvId.getDeclaredBy().getName()));
871 // } else if (!isProduced) {
872 // libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,
873 // lcvId.getDeclaredBy().getName()));
878 // return libraryClass;
880 public static Vector
<FindResultId
> getAllLibraryClassForFind(LibraryClassVector lcv
) {
881 Vector
<FindResultId
> libraryClass
= new Vector
<FindResultId
>();
882 boolean isAdded
= false;
883 boolean isProduced
= false;
886 // Go through pv to add item as new format to ppi one by one
888 for (int indexOfLcv
= 0; indexOfLcv
< lcv
.size(); indexOfLcv
++) {
890 LibraryClassIdentification lcvId
= lcv
.getLibraryClass(indexOfLcv
);
893 // First check if produced or not
895 if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
896 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
898 } else if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
899 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
904 // Check if the item has been added in
905 // If added, append package name and new module name
906 // If not added, add a new one first
908 for (int indexOfGuid
= 0; indexOfGuid
< libraryClass
.size(); indexOfGuid
++) {
909 FindResultId frId
= libraryClass
.get(indexOfGuid
);
911 if (lcvId
.getLibraryClassName().equals(frId
.getName())) {
913 libraryClass
.get(indexOfGuid
).addProducedModules(lcvId
.getBelongModule());
914 } else if (!isProduced
) {
915 libraryClass
.get(indexOfGuid
).addConsumedModules(lcvId
.getBelongModule());
926 libraryClass
.addElement(new FindResultId(lcvId
.getLibraryClassName(), "Library Class",
927 lcvId
.getSupArchList(), lcvId
.getHelp(),
928 lcvId
.getSupModuleList(), lcvId
.getDeclaredBy()));