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
.GuidDeclarationsDocument
.GuidDeclarations
;
20 import org
.tianocore
.LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
;
21 import org
.tianocore
.LibraryClassDefinitionsDocument
.LibraryClassDefinitions
;
22 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
23 import org
.tianocore
.PackageSurfaceAreaDocument
.PackageSurfaceArea
;
24 import org
.tianocore
.PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
;
25 import org
.tianocore
.PpiDeclarationsDocument
.PpiDeclarations
;
26 import org
.tianocore
.ProtocolDeclarationsDocument
.ProtocolDeclarations
;
27 import org
.tianocore
.frameworkwizard
.common
.DataType
;
28 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
29 import org
.tianocore
.frameworkwizard
.common
.Sort
;
30 import org
.tianocore
.frameworkwizard
.common
.Tools
;
31 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
32 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsIdentification
;
33 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Guids
.GuidsVector
;
34 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassIdentification
;
35 import org
.tianocore
.frameworkwizard
.module
.Identifications
.LibraryClass
.LibraryClassVector
;
36 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedIdentification
;
37 import org
.tianocore
.frameworkwizard
.module
.Identifications
.PcdCoded
.PcdCodedVector
;
38 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisIdentification
;
39 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisVector
;
40 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsIdentification
;
41 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Protocols
.ProtocolsVector
;
42 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
46 private final static String SEPERATOR
= ".";
49 Get all ppi entries from workspace
54 public static PpisVector
getAllPpisVector() {
55 PpisVector pv
= new PpisVector();
56 ModuleSurfaceArea msa
= null;
57 ModuleIdentification mid
= null;
58 PpisIdentification pid
= null;
61 // Go through each module one by one
63 if (GlobalData
.openingModuleList
.size() > 0) {
64 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
65 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
66 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
68 if (msa
.getPPIs() != null) {
69 if (msa
.getPPIs().getPpiList().size() > 0) {
70 for (int index
= 0; index
< msa
.getPPIs().getPpiList().size(); index
++) {
71 String arg0
= msa
.getPPIs().getPpiList().get(index
).getPpiCName();
72 String arg1
= DataType
.PPI_TYPE_PPI
;
74 if (msa
.getPPIs().getPpiList().get(index
).getUsage() != null) {
75 arg2
= msa
.getPPIs().getPpiList().get(index
).getUsage().toString();
78 String arg3
= msa
.getPPIs().getPpiList().get(index
).getFeatureFlag();
79 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiList().get(index
)
81 String arg5
= msa
.getPPIs().getPpiList().get(index
).getHelpText();
83 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
84 pid
.setBelongModule(mid
);
87 // Find which package declares it
89 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
90 PackageSurfaceArea spd
= GlobalData
.openingPackageList
91 .getOpeningPackageByIndex(
94 PackageIdentification packageId
= GlobalData
.openingPackageList
95 .getOpeningPackageByIndex(
98 if (spd
.getPpiDeclarations() != null) {
99 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
100 .size(); indexOfPpis
++) {
101 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
103 pid
.setDeclaredBy(packageId
);
109 if (pid
.getDeclaredBy() == null) {
110 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
116 if (msa
.getPPIs().getPpiNotifyList().size() > 0) {
117 for (int index
= 0; index
< msa
.getPPIs().getPpiNotifyList().size(); index
++) {
118 String arg0
= msa
.getPPIs().getPpiNotifyList().get(index
).getPpiNotifyCName();
119 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
121 if (msa
.getPPIs().getPpiNotifyList().get(index
).getUsage() != null) {
122 arg2
= msa
.getPPIs().getPpiNotifyList().get(index
).getUsage().toString();
125 String arg3
= msa
.getPPIs().getPpiNotifyList().get(index
).getFeatureFlag();
126 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getPPIs().getPpiNotifyList().get(index
)
128 String arg5
= msa
.getPPIs().getPpiNotifyList().get(index
).getHelpText();
130 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
131 pid
.setBelongModule(mid
);
134 // Find which package declares it
136 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
137 PackageSurfaceArea spd
= GlobalData
.openingPackageList
138 .getOpeningPackageByIndex(
141 PackageIdentification packageId
= GlobalData
.openingPackageList
142 .getOpeningPackageByIndex(
145 if (spd
.getPpiDeclarations() != null) {
146 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList()
147 .size(); indexOfPpis
++) {
148 if (spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
).getCName()
150 pid
.setDeclaredBy(packageId
);
156 if (pid
.getDeclaredBy() == null) {
157 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
167 // Go through all defined ppi to find which is not added yet.
169 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
170 PackageSurfaceArea spd
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
).getXmlSpd();
171 PackageIdentification packageId
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
)
173 if (spd
.getPpiDeclarations() != null) {
174 for (int indexOfPpis
= 0; indexOfPpis
< spd
.getPpiDeclarations().getEntryList().size(); indexOfPpis
++) {
175 boolean isFound
= false;
176 PpiDeclarations
.Entry e
= spd
.getPpiDeclarations().getEntryList().get(indexOfPpis
);
177 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
178 if (e
.getCName().equals(pv
.getPpis(indexOfPv
).getName())) {
184 String arg0
= e
.getCName();
188 Vector
<String
> arg4
= Tools
.convertListToVector(e
.getSupArchList());
189 String arg5
= e
.getHelpText();
191 pid
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
192 pid
.setBelongModule(null);
193 pid
.setDeclaredBy(packageId
);
199 Sort
.sortPpis(pv
, DataType
.SORT_TYPE_ASCENDING
);
204 Re-org all ppi entries for find table
209 public static Vector
<PpiId
> getAllPpisForFind() {
210 Vector
<PpiId
> ppi
= new Vector
<PpiId
>();
211 PpisVector pv
= Find
.getAllPpisVector();
212 boolean isAdded
= false;
213 boolean isProduced
= false;
216 // Go through pv to add item as new format to ppi one by one
218 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
220 PpisIdentification pvId
= pv
.getPpis(indexOfPv
);
223 // First check if produced or not
225 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
226 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
228 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
229 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
234 // Get the sting "PackageName.ModuleName"
237 if (pvId
.getBelongModule() != null) {
238 tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
242 // Check if the item has been added in
243 // If added, append package name and new module name
244 // If not added, add a new one first
246 for (int indexOfPpi
= 0; indexOfPpi
< ppi
.size(); indexOfPpi
++) {
247 PpiId ppiId
= ppi
.get(indexOfPpi
);
249 if (pvId
.getName().equals(ppiId
.getName())) {
251 ppi
.get(indexOfPpi
).setProducedModules(ppiId
.getProducedModules() + "<br>" + tmp
);
252 } else if (!isProduced
) {
253 ppi
.get(indexOfPpi
).setConsumedModules(ppiId
.getConsumedModules() + "<br>" + tmp
);
266 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy().getName()));
267 } else if (!isProduced
) {
269 .addElement(new PpiId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy().getName()));
278 Get all protocol entries from workspace
283 public static ProtocolsVector
getAllProtocolsVector() {
284 ProtocolsVector pv
= new ProtocolsVector();
285 ModuleSurfaceArea msa
= null;
286 ModuleIdentification mid
= null;
287 ProtocolsIdentification pid
= null;
290 // Go through each module one by one
292 if (GlobalData
.openingModuleList
.size() > 0) {
293 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
294 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
295 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
297 if (msa
.getProtocols() != null) {
298 if (msa
.getProtocols().getProtocolList().size() > 0) {
299 for (int index
= 0; index
< msa
.getProtocols().getProtocolList().size(); index
++) {
300 String arg0
= msa
.getProtocols().getProtocolList().get(index
).getProtocolCName();
301 String arg1
= DataType
.PROTOCOL_TYPE_PROTOCOL
;
303 if (msa
.getProtocols().getProtocolList().get(index
).getUsage() != null) {
304 arg2
= msa
.getProtocols().getProtocolList().get(index
).getUsage().toString();
307 String arg3
= msa
.getProtocols().getProtocolList().get(index
).getFeatureFlag();
308 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolList()
309 .get(index
).getSupArchList());
310 String arg5
= msa
.getProtocols().getProtocolList().get(index
).getHelpText();
312 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
313 pid
.setBelongModule(mid
);
316 // Find which package declares it
318 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
319 PackageSurfaceArea spd
= GlobalData
.openingPackageList
320 .getOpeningPackageByIndex(
323 PackageIdentification packageId
= GlobalData
.openingPackageList
324 .getOpeningPackageByIndex(
327 if (spd
.getProtocolDeclarations() != null) {
328 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
329 .getEntryList().size(); indexOfProtocols
++) {
330 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
331 .getCName().equals(arg0
)) {
332 pid
.setDeclaredBy(packageId
);
338 if (pid
.getDeclaredBy() == null) {
339 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
341 pv
.addProtocols(pid
);
344 if (msa
.getProtocols().getProtocolNotifyList().size() > 0) {
345 for (int index
= 0; index
< msa
.getProtocols().getProtocolNotifyList().size(); index
++) {
346 String arg0
= msa
.getProtocols().getProtocolNotifyList().get(index
)
347 .getProtocolNotifyCName();
348 String arg1
= DataType
.PPI_TYPE_PPI_NOTIFY
;
350 if (msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage() != null) {
351 arg2
= msa
.getProtocols().getProtocolNotifyList().get(index
).getUsage().toString();
354 String arg3
= msa
.getProtocols().getProtocolNotifyList().get(index
).getFeatureFlag();
355 Vector
<String
> arg4
= Tools
.convertListToVector(msa
.getProtocols().getProtocolNotifyList()
356 .get(index
).getSupArchList());
357 String arg5
= msa
.getProtocols().getProtocolNotifyList().get(index
).getHelpText();
359 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
360 pid
.setBelongModule(mid
);
363 // Find which package declares it
365 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
366 PackageSurfaceArea spd
= GlobalData
.openingPackageList
367 .getOpeningPackageByIndex(
370 PackageIdentification packageId
= GlobalData
.openingPackageList
371 .getOpeningPackageByIndex(
374 if (spd
.getProtocolDeclarations() != null) {
375 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations()
376 .getEntryList().size(); indexOfProtocols
++) {
377 if (spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
)
378 .getCName().equals(arg0
)) {
379 pid
.setDeclaredBy(packageId
);
385 if (pid
.getDeclaredBy() == null) {
386 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
389 pv
.addProtocols(pid
);
396 // Go through all defined protocols to find which is not added yet.
398 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
399 PackageSurfaceArea spd
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
).getXmlSpd();
400 PackageIdentification packageId
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
)
402 if (spd
.getProtocolDeclarations() != null) {
403 for (int indexOfProtocols
= 0; indexOfProtocols
< spd
.getProtocolDeclarations().getEntryList().size(); indexOfProtocols
++) {
404 boolean isFound
= false;
405 ProtocolDeclarations
.Entry e
= spd
.getProtocolDeclarations().getEntryList().get(indexOfProtocols
);
406 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
407 if (e
.getCName().equals(pv
.getProtocols(indexOfPv
).getName())) {
413 String arg0
= e
.getCName();
417 Vector
<String
> arg4
= Tools
.convertListToVector(e
.getSupArchList());
418 String arg5
= e
.getHelpText();
420 pid
= new ProtocolsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
421 pid
.setBelongModule(null);
422 pid
.setDeclaredBy(packageId
);
423 pv
.addProtocols(pid
);
428 Sort
.sortProtocols(pv
, DataType
.SORT_TYPE_ASCENDING
);
433 Re-org all protocol entries for find table
438 public static Vector
<ProtocolId
> getAllProtocolsForFind() {
439 Vector
<ProtocolId
> protocol
= new Vector
<ProtocolId
>();
440 ProtocolsVector pv
= Find
.getAllProtocolsVector();
441 boolean isAdded
= false;
442 boolean isProduced
= false;
445 // Go through pv to add item as new format to ppi one by one
447 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
449 ProtocolsIdentification pvId
= pv
.getProtocols(indexOfPv
);
452 // First check if produced or not
454 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
455 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
457 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
458 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
463 // Get the sting "PackageName.ModuleName"
466 if (pvId
.getBelongModule() != null) {
467 tmp
= pvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ pvId
.getBelongModule().getName();
471 // Check if the item has been added in
472 // If added, append package name and new module name
473 // If not added, add a new one first
475 for (int indexOfProtocol
= 0; indexOfProtocol
< protocol
.size(); indexOfProtocol
++) {
476 ProtocolId protocolId
= protocol
.get(indexOfProtocol
);
478 if (pvId
.getName().equals(protocolId
.getName())) {
480 protocol
.get(indexOfProtocol
)
481 .setProducedModules(protocolId
.getProducedModules() + "<br>" + tmp
);
482 } else if (!isProduced
) {
483 protocol
.get(indexOfProtocol
)
484 .setConsumedModules(protocolId
.getConsumedModules() + "<br>" + tmp
);
496 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), tmp
, null, pvId
.getDeclaredBy()
498 } else if (!isProduced
) {
499 protocol
.addElement(new ProtocolId(pvId
.getName(), pvId
.getType(), null, tmp
, pvId
.getDeclaredBy()
509 Get all protocol entries from workspace
514 public static GuidsVector
getAllGuidsVector() {
515 GuidsVector gv
= new GuidsVector();
516 ModuleSurfaceArea msa
= null;
517 ModuleIdentification mid
= null;
518 GuidsIdentification gid
= null;
521 // Go through each module one by one
523 if (GlobalData
.openingModuleList
.size() > 0) {
524 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
525 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
526 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
528 if (msa
.getGuids() != null) {
529 if (msa
.getGuids().getGuidCNamesList().size() > 0) {
530 for (int index
= 0; index
< msa
.getGuids().getGuidCNamesList().size(); index
++) {
531 String arg0
= msa
.getGuids().getGuidCNamesList().get(index
).getGuidCName();
533 if (msa
.getGuids().getGuidCNamesList().get(index
).getUsage() != null) {
534 arg1
= msa
.getGuids().getGuidCNamesList().get(index
).getUsage().toString();
537 String arg2
= msa
.getGuids().getGuidCNamesList().get(index
).getFeatureFlag();
538 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getGuids().getGuidCNamesList()
539 .get(index
).getSupArchList());
540 String arg4
= msa
.getGuids().getGuidCNamesList().get(index
).getHelpText();
542 gid
= new GuidsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
);
543 gid
.setBelongModule(mid
);
546 // Find which package declares it
548 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
549 PackageSurfaceArea spd
= GlobalData
.openingPackageList
550 .getOpeningPackageByIndex(
553 PackageIdentification packageId
= GlobalData
.openingPackageList
554 .getOpeningPackageByIndex(
557 if (spd
.getGuidDeclarations() != null) {
558 for (int indexOfGuids
= 0; indexOfGuids
< spd
.getGuidDeclarations().getEntryList()
559 .size(); indexOfGuids
++) {
560 if (spd
.getGuidDeclarations().getEntryList().get(indexOfGuids
).getCName()
562 gid
.setDeclaredBy(packageId
);
568 if (gid
.getDeclaredBy() == null) {
569 gid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
579 // Go through all defined guids to find which is not added yet.
581 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
582 PackageSurfaceArea spd
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
).getXmlSpd();
583 PackageIdentification packageId
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
)
585 if (spd
.getGuidDeclarations() != null) {
586 for (int indexOfGuids
= 0; indexOfGuids
< spd
.getGuidDeclarations().getEntryList().size(); indexOfGuids
++) {
587 boolean isFound
= false;
588 GuidDeclarations
.Entry e
= spd
.getGuidDeclarations().getEntryList().get(indexOfGuids
);
589 for (int indexOfGv
= 0; indexOfGv
< gv
.size(); indexOfGv
++) {
590 if (e
.getCName().equals(gv
.getGuids(indexOfGv
).getName())) {
596 String arg0
= e
.getCName();
599 Vector
<String
> arg3
= Tools
.convertListToVector(e
.getSupArchList());
600 String arg4
= e
.getHelpText();
602 gid
= new GuidsIdentification(arg0
, arg1
, arg2
, arg3
, arg4
);
603 gid
.setBelongModule(null);
604 gid
.setDeclaredBy(packageId
);
610 Sort
.sortGuids(gv
, DataType
.SORT_TYPE_ASCENDING
);
615 Re-org all guid entries for find table
620 public static Vector
<GuidId
> getAllGuidsForFind() {
621 Vector
<GuidId
> guid
= new Vector
<GuidId
>();
622 GuidsVector gv
= Find
.getAllGuidsVector();
623 boolean isAdded
= false;
624 boolean isProduced
= false;
627 // Go through pv to add item as new format to ppi one by one
629 for (int indexOfGv
= 0; indexOfGv
< gv
.size(); indexOfGv
++) {
631 GuidsIdentification gvId
= gv
.getGuids(indexOfGv
);
634 // First check if produced or not
636 if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
637 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
639 } else if (gvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
640 || gvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
645 // Get the sting "PackageName.ModuleName"
648 if (gvId
.getBelongModule() != null) {
649 tmp
= gvId
.getBelongModule().getPackageId().getName() + SEPERATOR
+ gvId
.getBelongModule().getName();
653 // Check if the item has been added in
654 // If added, append package name and new module name
655 // If not added, add a new one first
657 for (int indexOfGuid
= 0; indexOfGuid
< guid
.size(); indexOfGuid
++) {
658 GuidId guidId
= guid
.get(indexOfGuid
);
660 if (gvId
.getName().equals(guidId
.getName())) {
662 guid
.get(indexOfGuid
).setProducedModules(guidId
.getProducedModules() + "<br>" + tmp
);
663 } else if (!isProduced
) {
664 guid
.get(indexOfGuid
).setConsumedModules(guidId
.getConsumedModules() + "<br>" + tmp
);
676 guid
.addElement(new GuidId(gvId
.getName(), "GUID", tmp
, null, gvId
.getDeclaredBy().getName()));
677 } else if (!isProduced
) {
678 guid
.addElement(new GuidId(gvId
.getName(), "GUID", null, tmp
, gvId
.getDeclaredBy().getName()));
687 Get all pcd coded entries from workspace
692 public static PcdCodedVector
getAllPcdCodedVector() {
693 PcdCodedVector pv
= new PcdCodedVector();
694 ModuleSurfaceArea msa
= null;
695 ModuleIdentification mid
= null;
696 PcdCodedIdentification pid
= null;
699 // Go through each module one by one
701 if (GlobalData
.openingModuleList
.size() > 0) {
702 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
703 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
704 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
706 if (msa
.getPcdCoded() != null) {
707 if (msa
.getPcdCoded().getPcdEntryList().size() > 0) {
708 for (int index
= 0; index
< msa
.getPcdCoded().getPcdEntryList().size(); index
++) {
710 String arg0
= msa
.getPcdCoded().getPcdEntryList().get(index
).getCName();
711 String arg1
= msa
.getPcdCoded().getPcdEntryList().get(index
).getTokenSpaceGuidCName();
713 String arg2
= msa
.getPcdCoded().getPcdEntryList().get(index
).getFeatureFlag();
714 Vector
<String
> arg3
= Tools
.convertListToVector(msa
.getPcdCoded().getPcdEntryList()
715 .get(index
).getSupArchList());
717 String arg4
= msa
.getPcdCoded().getPcdEntryList().get(index
).getDefaultValue();
718 String arg5
= msa
.getPcdCoded().getPcdEntryList().get(index
).getHelpText();
720 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType() != null) {
721 arg6
= msa
.getPcdCoded().getPcdEntryList().get(index
).getPcdItemType().toString();
724 if (msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage() != null) {
725 arg7
= msa
.getPcdCoded().getPcdEntryList().get(index
).getUsage().toString();
727 pid
= new PcdCodedIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, arg7
);
728 pid
.setBelongModule(mid
);
731 // Find which package declares it
733 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
734 PackageSurfaceArea spd
= GlobalData
.openingPackageList
735 .getOpeningPackageByIndex(
738 PackageIdentification packageId
= GlobalData
.openingPackageList
739 .getOpeningPackageByIndex(
742 if (spd
.getPcdDeclarations() != null) {
743 for (int indexOfPcds
= 0; indexOfPcds
< spd
.getPcdDeclarations().getPcdEntryList()
744 .size(); indexOfPcds
++) {
745 PcdEntry pcdEntry
= spd
.getPcdDeclarations().getPcdEntryList().get(indexOfPcds
);
746 if (pcdEntry
.getCName().equals(arg0
)) {
747 pid
.setTokenSpaceGuidCName(pcdEntry
.getTokenSpaceGuidCName());
748 pid
.setToken(pcdEntry
.getToken().toString());
749 pid
.setDatumType(pcdEntry
.getDatumType().toString());
750 pid
.setValue(pcdEntry
.getDefaultValue());
751 pid
.setUsage(Tools
.convertListToString(pcdEntry
.getValidUsage()));
752 pid
.setHelp(pcdEntry
.getHelpText());
753 pid
.setDeclaredBy(packageId
);
759 if (pid
.getDeclaredBy() == null) {
760 pid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
770 // Go through all defined pcds to find which is not added yet.
772 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
773 PackageSurfaceArea spd
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
).getXmlSpd();
774 PackageIdentification packageId
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
)
776 if (spd
.getPcdDeclarations() != null) {
777 for (int indexOfPcds
= 0; indexOfPcds
< spd
.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds
++) {
778 boolean isFound
= false;
779 PcdEntry e
= spd
.getPcdDeclarations().getPcdEntryList().get(indexOfPcds
);
780 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
781 if (e
.getCName().equals(pv
.getPcdCoded(indexOfPv
).getName())) {
787 pid
= new PcdCodedIdentification("", "", "", null, "", "", null, null);
788 pid
.setName(e
.getCName());
789 pid
.setTokenSpaceGuidCName(e
.getTokenSpaceGuidCName());
790 pid
.setToken(e
.getToken().toString());
791 pid
.setDatumType(e
.getDatumType().toString());
792 pid
.setValue(e
.getDefaultValue());
793 pid
.setUsage(Tools
.convertListToString(e
.getValidUsage()));
794 pid
.setHelp(e
.getHelpText());
795 pid
.setDeclaredBy(packageId
);
797 pid
.setBelongModule(null);
803 Sort
.sortPcdCodeds(pv
, DataType
.SORT_TYPE_ASCENDING
);
813 public static Vector
<PcdFindResultId
> getAllPcdCodedForFind(PcdCodedVector pv
) {
814 Vector
<PcdFindResultId
> pcd
= new Vector
<PcdFindResultId
>();
815 boolean isAdded
= false;
816 boolean isProduced
= false;
819 // Go through pv to add item as new format to ppi one by one
821 for (int indexOfPv
= 0; indexOfPv
< pv
.size(); indexOfPv
++) {
823 PcdCodedIdentification pvId
= pv
.getPcdCoded(indexOfPv
);
826 // First check if produced or not
828 if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
829 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
831 } else if (pvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
832 || pvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
837 // Check if the item has been added in
838 // If added, append package name and new module name
839 // If not added, add a new one first
841 for (int indexOfGuid
= 0; indexOfGuid
< pcd
.size(); indexOfGuid
++) {
842 PcdFindResultId pcdId
= pcd
.get(indexOfGuid
);
844 if (pvId
.getName().equals(pcdId
.getName())) {
846 pcd
.get(indexOfGuid
).addProducedModules(pvId
.getBelongModule());
847 } else if (!isProduced
) {
848 pcd
.get(indexOfGuid
).addConsumedModules(pvId
.getBelongModule());
859 PcdFindResultId pcdId
= new PcdFindResultId(pvId
.getName(), "PCD", pvId
.getSupArchList(),
860 pvId
.getHelp(), null, pvId
.getDeclaredBy());
861 pcdId
.setTokenSpaceGuidCName(pvId
.getTokenSpaceGuidCName());
862 pcdId
.setToken(pvId
.getToken());
863 pcdId
.setDatumType(pvId
.getDatumType());
864 pcdId
.setValue(pvId
.getValue());
865 pcdId
.setUsage(pvId
.getUsage());
867 pcd
.addElement(pcdId
);
875 Get all library class entries from workspace
880 public static LibraryClassVector
getAllLibraryClassVector() {
881 LibraryClassVector lcv
= new LibraryClassVector();
882 ModuleSurfaceArea msa
= null;
883 ModuleIdentification mid
= null;
884 LibraryClassIdentification lcid
= null;
887 // Go through each module one by one
889 if (GlobalData
.openingModuleList
.size() > 0) {
890 for (int indexOfModule
= 0; indexOfModule
< GlobalData
.openingModuleList
.size(); indexOfModule
++) {
891 msa
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getXmlMsa();
892 mid
= GlobalData
.openingModuleList
.getOpeningModuleByIndex(indexOfModule
).getId();
894 if (msa
.getLibraryClassDefinitions() != null) {
895 LibraryClassDefinitions lcd
= msa
.getLibraryClassDefinitions();
896 if (lcd
.getLibraryClassList().size() > 0) {
897 for (int index
= 0; index
< lcd
.getLibraryClassList().size(); index
++) {
898 String name
= lcd
.getLibraryClassList().get(index
).getKeyword();
900 if (lcd
.getLibraryClassList().get(index
).getUsage() != null) {
901 usage
= lcd
.getLibraryClassList().get(index
).getUsage().toString();
903 String version
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceVersion();
904 String guid
= lcd
.getLibraryClassList().get(index
).getRecommendedInstanceGuid();
905 String featureFlag
= lcd
.getLibraryClassList().get(index
).getFeatureFlag();
906 Vector
<String
> arch
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
908 Vector
<String
> module
= Tools
.convertListToVector(lcd
.getLibraryClassList().get(index
)
909 .getSupModuleList());
910 String help
= lcd
.getLibraryClassList().get(index
).getHelpText();
911 lcid
= new LibraryClassIdentification(name
, usage
, version
, guid
, arch
, featureFlag
,
913 lcid
.setBelongModule(mid
);
916 // Find which package declares it
918 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
919 PackageSurfaceArea spd
= GlobalData
.openingPackageList
920 .getOpeningPackageByIndex(
923 PackageIdentification packageId
= GlobalData
.openingPackageList
924 .getOpeningPackageByIndex(
927 if (spd
.getLibraryClassDeclarations() != null) {
928 for (int indexOfLibraryClass
= 0; indexOfLibraryClass
< spd
929 .getLibraryClassDeclarations()
930 .getLibraryClassList()
931 .size(); indexOfLibraryClass
++) {
932 LibraryClass lc
= spd
.getLibraryClassDeclarations().getLibraryClassList()
933 .get(indexOfLibraryClass
);
934 if (lc
.getName().equals(name
)) {
935 lcid
.setSupArchList(Tools
.convertListToVector(lc
.getSupArchList()));
936 lcid
.setSupModuleList(Tools
.convertListToVector(lc
.getSupModuleList()));
937 lcid
.setHelp(lc
.getHelpText());
938 lcid
.setDeclaredBy(packageId
);
944 if (lcid
.getDeclaredBy() == null) {
945 lcid
.setDeclaredBy(new PackageIdentification("", "", "", ""));
948 lcv
.addLibraryClass(lcid
);
955 // Go through all defined pcds to find which is not added yet.
957 for (int indexOfPackage
= 0; indexOfPackage
< GlobalData
.openingPackageList
.size(); indexOfPackage
++) {
958 PackageSurfaceArea spd
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
).getXmlSpd();
959 PackageIdentification packageId
= GlobalData
.openingPackageList
.getOpeningPackageByIndex(indexOfPackage
)
961 if (spd
.getLibraryClassDeclarations() != null) {
962 for (int indexOfLibraryClass
= 0; indexOfLibraryClass
< spd
.getLibraryClassDeclarations()
963 .getLibraryClassList().size(); indexOfLibraryClass
++) {
964 boolean isFound
= false;
965 LibraryClass lc
= spd
.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass
);
966 for (int indexOfLcv
= 0; indexOfLcv
< lcv
.size(); indexOfLcv
++) {
967 if (lc
.getName().equals(lcv
.getLibraryClass(indexOfLcv
).getLibraryClassName())) {
973 lcid
= new LibraryClassIdentification("", null, "", "", null, "", null, "");
974 lcid
.setLibraryClassName(lc
.getName());
975 lcid
.setSupArchList(Tools
.convertListToVector(lc
.getSupArchList()));
976 lcid
.setSupModuleList(Tools
.convertListToVector(lc
.getSupModuleList()));
977 lcid
.setHelp(lc
.getHelpText());
978 lcid
.setDeclaredBy(packageId
);
980 lcid
.setBelongModule(null);
981 lcv
.addLibraryClass(lcid
);
986 Sort
.sortLibraryClass(lcv
, DataType
.SORT_TYPE_ASCENDING
);
991 Re-org all guid entries for find table
996 public static Vector
<FindResultId
> getAllLibraryClassForFind(LibraryClassVector lcv
) {
997 Vector
<FindResultId
> libraryClass
= new Vector
<FindResultId
>();
998 boolean isAdded
= false;
999 boolean isProduced
= false;
1002 // Go through pv to add item as new format to ppi one by one
1004 for (int indexOfLcv
= 0; indexOfLcv
< lcv
.size(); indexOfLcv
++) {
1006 LibraryClassIdentification lcvId
= lcv
.getLibraryClass(indexOfLcv
);
1009 // First check if produced or not
1011 if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_PRODUCED
)
1012 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_PRODUCED
)) {
1014 } else if (lcvId
.getUsage().equals(DataType
.USAGE_TYPE_ALWAYS_CONSUMED
)
1015 || lcvId
.getUsage().equals(DataType
.USAGE_TYPE_SOMETIMES_CONSUMED
)) {
1020 // Check if the item has been added in
1021 // If added, append package name and new module name
1022 // If not added, add a new one first
1024 for (int indexOfGuid
= 0; indexOfGuid
< libraryClass
.size(); indexOfGuid
++) {
1025 FindResultId frId
= libraryClass
.get(indexOfGuid
);
1027 if (lcvId
.getLibraryClassName().equals(frId
.getName())) {
1029 libraryClass
.get(indexOfGuid
).addProducedModules(lcvId
.getBelongModule());
1030 } else if (!isProduced
) {
1031 libraryClass
.get(indexOfGuid
).addConsumedModules(lcvId
.getBelongModule());
1042 libraryClass
.addElement(new FindResultId(lcvId
.getLibraryClassName(), "Library Class",
1043 lcvId
.getSupArchList(), lcvId
.getHelp(),
1044 lcvId
.getSupModuleList(), lcvId
.getDeclaredBy()));
1048 return libraryClass
;