+++ /dev/null
-/** @file\r
-\r
- The file is used to provide Find funtions in workspace\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.frameworkwizard.common.find;\r
-\r
-import java.util.Vector;\r
-\r
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;\r
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
-import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;\r
-import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;\r
-import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;\r
-import org.tianocore.frameworkwizard.common.DataType;\r
-import org.tianocore.frameworkwizard.common.GlobalData;\r
-import org.tianocore.frameworkwizard.common.Sort;\r
-import org.tianocore.frameworkwizard.common.Tools;\r
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;\r
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;\r
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;\r
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;\r
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;\r
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
-\r
-public class Find {\r
-\r
- private final static String SEPERATOR = ".";\r
-\r
- /**\r
- Get all ppi entries from workspace\r
- \r
- @return\r
- \r
- **/\r
- public static PpisVector getAllPpisVector() {\r
- PpisVector pv = new PpisVector();\r
- ModuleSurfaceArea msa = null;\r
- ModuleIdentification mid = null;\r
- PpisIdentification pid = null;\r
-\r
- //\r
- // Go through each module one by one\r
- //\r
- if (GlobalData.openingModuleList.size() > 0) {\r
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r
-\r
- if (msa.getPPIs() != null) {\r
- if (msa.getPPIs().getPpiList().size() > 0) {\r
- for (int index = 0; index < msa.getPPIs().getPpiList().size(); index++) {\r
- String arg0 = msa.getPPIs().getPpiList().get(index).getPpiCName();\r
- String arg1 = DataType.PPI_TYPE_PPI;\r
- String arg2 = null;\r
- if (msa.getPPIs().getPpiList().get(index).getUsage() != null) {\r
- arg2 = msa.getPPIs().getPpiList().get(index).getUsage().toString();\r
- }\r
-\r
- String arg3 = msa.getPPIs().getPpiList().get(index).getFeatureFlag();\r
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiList().get(index)\r
- .getSupArchList());\r
- String arg5 = msa.getPPIs().getPpiList().get(index).getHelpText();\r
-\r
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getPpiDeclarations() != null) {\r
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()\r
- .size(); indexOfPpis++) {\r
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()\r
- .equals(arg0)) {\r
- pid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pid.getDeclaredBy() == null) {\r
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- pv.addPpis(pid);\r
- }\r
- }\r
- if (msa.getPPIs().getPpiNotifyList().size() > 0) {\r
- for (int index = 0; index < msa.getPPIs().getPpiNotifyList().size(); index++) {\r
- String arg0 = msa.getPPIs().getPpiNotifyList().get(index).getPpiNotifyCName();\r
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;\r
- String arg2 = null;\r
- if (msa.getPPIs().getPpiNotifyList().get(index).getUsage() != null) {\r
- arg2 = msa.getPPIs().getPpiNotifyList().get(index).getUsage().toString();\r
- }\r
-\r
- String arg3 = msa.getPPIs().getPpiNotifyList().get(index).getFeatureFlag();\r
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiNotifyList().get(index)\r
- .getSupArchList());\r
- String arg5 = msa.getPPIs().getPpiNotifyList().get(index).getHelpText();\r
-\r
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getPpiDeclarations() != null) {\r
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()\r
- .size(); indexOfPpis++) {\r
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()\r
- .equals(arg0)) {\r
- pid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pid.getDeclaredBy() == null) {\r
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- pv.addPpis(pid);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Go through all defined ppi to find which is not added yet.\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
- .getId();\r
- if (spd.getPpiDeclarations() != null) {\r
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList().size(); indexOfPpis++) {\r
- boolean isFound = false;\r
- PpiDeclarations.Entry e = spd.getPpiDeclarations().getEntryList().get(indexOfPpis);\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- if (e.getCName().equals(pv.getPpis(indexOfPv).getName())) {\r
- isFound = true;\r
- break;\r
- }\r
- }\r
- if (!isFound) {\r
- String arg0 = e.getCName();\r
- String arg1 = "";\r
- String arg2 = "";\r
- String arg3 = "";\r
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r
- String arg5 = e.getHelpText();\r
-\r
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(null);\r
- pid.setDeclaredBy(packageId);\r
- pv.addPpis(pid);\r
- }\r
- }\r
- }\r
- }\r
- Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);\r
- return pv;\r
- }\r
-\r
- /**\r
- Re-org all ppi entries for find table\r
- \r
- @return\r
- \r
- **/\r
- public static Vector<PpiId> getAllPpisForFind() {\r
- Vector<PpiId> ppi = new Vector<PpiId>();\r
- PpisVector pv = Find.getAllPpisVector();\r
- boolean isAdded = false;\r
- boolean isProduced = false;\r
-\r
- //\r
- // Go through pv to add item as new format to ppi one by one\r
- //\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- isAdded = false;\r
- PpisIdentification pvId = pv.getPpis(indexOfPv);\r
-\r
- //\r
- // First check if produced or not\r
- //\r
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
- isProduced = true;\r
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
- isProduced = false;\r
- }\r
-\r
- //\r
- // Get the sting "PackageName.ModuleName" \r
- //\r
- String tmp = "";\r
- if (pvId.getBelongModule() != null) {\r
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
- }\r
-\r
- //\r
- // Check if the item has been added in\r
- // If added, append package name and new module name\r
- // If not added, add a new one first\r
- //\r
- for (int indexOfPpi = 0; indexOfPpi < ppi.size(); indexOfPpi++) {\r
- PpiId ppiId = ppi.get(indexOfPpi);\r
-\r
- if (pvId.getName().equals(ppiId.getName())) {\r
- if (isProduced) {\r
- ppi.get(indexOfPpi).setProducedModules(ppiId.getProducedModules() + "<br>" + tmp);\r
- } else if (!isProduced) {\r
- ppi.get(indexOfPpi).setConsumedModules(ppiId.getConsumedModules() + "<br>" + tmp);\r
- }\r
- isAdded = true;\r
- continue;\r
- }\r
- }\r
-\r
- //\r
- // Add a new one\r
- //\r
- if (!isAdded) {\r
- if (isProduced) {\r
- ppi\r
- .addElement(new PpiId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));\r
- } else if (!isProduced) {\r
- ppi\r
- .addElement(new PpiId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));\r
- }\r
- }\r
- }\r
-\r
- return ppi;\r
- }\r
-\r
- /**\r
- Get all protocol entries from workspace\r
- \r
- @return\r
- \r
- **/\r
- public static ProtocolsVector getAllProtocolsVector() {\r
- ProtocolsVector pv = new ProtocolsVector();\r
- ModuleSurfaceArea msa = null;\r
- ModuleIdentification mid = null;\r
- ProtocolsIdentification pid = null;\r
-\r
- //\r
- // Go through each module one by one\r
- //\r
- if (GlobalData.openingModuleList.size() > 0) {\r
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r
-\r
- if (msa.getProtocols() != null) {\r
- if (msa.getProtocols().getProtocolList().size() > 0) {\r
- for (int index = 0; index < msa.getProtocols().getProtocolList().size(); index++) {\r
- String arg0 = msa.getProtocols().getProtocolList().get(index).getProtocolCName();\r
- String arg1 = DataType.PROTOCOL_TYPE_PROTOCOL;\r
- String arg2 = null;\r
- if (msa.getProtocols().getProtocolList().get(index).getUsage() != null) {\r
- arg2 = msa.getProtocols().getProtocolList().get(index).getUsage().toString();\r
- }\r
-\r
- String arg3 = msa.getProtocols().getProtocolList().get(index).getFeatureFlag();\r
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolList()\r
- .get(index).getSupArchList());\r
- String arg5 = msa.getProtocols().getProtocolList().get(index).getHelpText();\r
-\r
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getProtocolDeclarations() != null) {\r
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()\r
- .getEntryList().size(); indexOfProtocols++) {\r
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)\r
- .getCName().equals(arg0)) {\r
- pid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pid.getDeclaredBy() == null) {\r
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
- pv.addProtocols(pid);\r
- }\r
- }\r
- if (msa.getProtocols().getProtocolNotifyList().size() > 0) {\r
- for (int index = 0; index < msa.getProtocols().getProtocolNotifyList().size(); index++) {\r
- String arg0 = msa.getProtocols().getProtocolNotifyList().get(index)\r
- .getProtocolNotifyCName();\r
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;\r
- String arg2 = null;\r
- if (msa.getProtocols().getProtocolNotifyList().get(index).getUsage() != null) {\r
- arg2 = msa.getProtocols().getProtocolNotifyList().get(index).getUsage().toString();\r
- }\r
-\r
- String arg3 = msa.getProtocols().getProtocolNotifyList().get(index).getFeatureFlag();\r
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolNotifyList()\r
- .get(index).getSupArchList());\r
- String arg5 = msa.getProtocols().getProtocolNotifyList().get(index).getHelpText();\r
-\r
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getProtocolDeclarations() != null) {\r
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()\r
- .getEntryList().size(); indexOfProtocols++) {\r
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)\r
- .getCName().equals(arg0)) {\r
- pid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pid.getDeclaredBy() == null) {\r
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- pv.addProtocols(pid);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Go through all defined protocols to find which is not added yet.\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
- .getId();\r
- if (spd.getProtocolDeclarations() != null) {\r
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations().getEntryList().size(); indexOfProtocols++) {\r
- boolean isFound = false;\r
- ProtocolDeclarations.Entry e = spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols);\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- if (e.getCName().equals(pv.getProtocols(indexOfPv).getName())) {\r
- isFound = true;\r
- break;\r
- }\r
- }\r
- if (!isFound) {\r
- String arg0 = e.getCName();\r
- String arg1 = "";\r
- String arg2 = "";\r
- String arg3 = "";\r
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r
- String arg5 = e.getHelpText();\r
-\r
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
- pid.setBelongModule(null);\r
- pid.setDeclaredBy(packageId);\r
- pv.addProtocols(pid);\r
- }\r
- }\r
- }\r
- }\r
- Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);\r
- return pv;\r
- }\r
-\r
- /**\r
- Re-org all protocol entries for find table\r
- \r
- @return\r
- \r
- **/\r
- public static Vector<ProtocolId> getAllProtocolsForFind() {\r
- Vector<ProtocolId> protocol = new Vector<ProtocolId>();\r
- ProtocolsVector pv = Find.getAllProtocolsVector();\r
- boolean isAdded = false;\r
- boolean isProduced = false;\r
-\r
- //\r
- // Go through pv to add item as new format to ppi one by one\r
- //\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- isAdded = false;\r
- ProtocolsIdentification pvId = pv.getProtocols(indexOfPv);\r
-\r
- //\r
- // First check if produced or not\r
- //\r
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
- isProduced = true;\r
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
- isProduced = false;\r
- }\r
-\r
- //\r
- // Get the sting "PackageName.ModuleName" \r
- //\r
- String tmp = "";\r
- if (pvId.getBelongModule() != null) {\r
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
- }\r
-\r
- //\r
- // Check if the item has been added in\r
- // If added, append package name and new module name\r
- // If not added, add a new one first\r
- //\r
- for (int indexOfProtocol = 0; indexOfProtocol < protocol.size(); indexOfProtocol++) {\r
- ProtocolId protocolId = protocol.get(indexOfProtocol);\r
-\r
- if (pvId.getName().equals(protocolId.getName())) {\r
- if (isProduced) {\r
- protocol.get(indexOfProtocol)\r
- .setProducedModules(protocolId.getProducedModules() + "<br>" + tmp);\r
- } else if (!isProduced) {\r
- protocol.get(indexOfProtocol)\r
- .setConsumedModules(protocolId.getConsumedModules() + "<br>" + tmp);\r
- }\r
- isAdded = true;\r
- continue;\r
- }\r
- }\r
-\r
- //\r
- // Add a new one\r
- //\r
- if (!isAdded) {\r
- if (isProduced) {\r
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy()\r
- .getName()));\r
- } else if (!isProduced) {\r
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy()\r
- .getName()));\r
- }\r
- }\r
- }\r
-\r
- return protocol;\r
- }\r
-\r
- /**\r
- Get all protocol entries from workspace\r
- \r
- @return\r
- \r
- **/\r
- public static GuidsVector getAllGuidsVector() {\r
- GuidsVector gv = new GuidsVector();\r
- ModuleSurfaceArea msa = null;\r
- ModuleIdentification mid = null;\r
- GuidsIdentification gid = null;\r
-\r
- //\r
- // Go through each module one by one\r
- //\r
- if (GlobalData.openingModuleList.size() > 0) {\r
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r
-\r
- if (msa.getGuids() != null) {\r
- if (msa.getGuids().getGuidCNamesList().size() > 0) {\r
- for (int index = 0; index < msa.getGuids().getGuidCNamesList().size(); index++) {\r
- String arg0 = msa.getGuids().getGuidCNamesList().get(index).getGuidCName();\r
- String arg1 = null;\r
- if (msa.getGuids().getGuidCNamesList().get(index).getUsage() != null) {\r
- arg1 = msa.getGuids().getGuidCNamesList().get(index).getUsage().toString();\r
- }\r
-\r
- String arg2 = msa.getGuids().getGuidCNamesList().get(index).getFeatureFlag();\r
- Vector<String> arg3 = Tools.convertListToVector(msa.getGuids().getGuidCNamesList()\r
- .get(index).getSupArchList());\r
- String arg4 = msa.getGuids().getGuidCNamesList().get(index).getHelpText();\r
-\r
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);\r
- gid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getGuidDeclarations() != null) {\r
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList()\r
- .size(); indexOfGuids++) {\r
- if (spd.getGuidDeclarations().getEntryList().get(indexOfGuids).getCName()\r
- .equals(arg0)) {\r
- gid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (gid.getDeclaredBy() == null) {\r
- gid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- gv.addGuids(gid);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Go through all defined guids to find which is not added yet.\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
- .getId();\r
- if (spd.getGuidDeclarations() != null) {\r
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList().size(); indexOfGuids++) {\r
- boolean isFound = false;\r
- GuidDeclarations.Entry e = spd.getGuidDeclarations().getEntryList().get(indexOfGuids);\r
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {\r
- if (e.getCName().equals(gv.getGuids(indexOfGv).getName())) {\r
- isFound = true;\r
- break;\r
- }\r
- }\r
- if (!isFound) {\r
- String arg0 = e.getCName();\r
- String arg1 = "";\r
- String arg2 = "";\r
- Vector<String> arg3 = Tools.convertListToVector(e.getSupArchList());\r
- String arg4 = e.getHelpText();\r
-\r
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);\r
- gid.setBelongModule(null);\r
- gid.setDeclaredBy(packageId);\r
- gv.addGuids(gid);\r
- }\r
- }\r
- }\r
- }\r
- Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);\r
- return gv;\r
- }\r
-\r
- /**\r
- Re-org all guid entries for find table\r
- \r
- @return\r
- \r
- **/\r
- public static Vector<GuidId> getAllGuidsForFind() {\r
- Vector<GuidId> guid = new Vector<GuidId>();\r
- GuidsVector gv = Find.getAllGuidsVector();\r
- boolean isAdded = false;\r
- boolean isProduced = false;\r
-\r
- //\r
- // Go through pv to add item as new format to ppi one by one\r
- //\r
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {\r
- isAdded = false;\r
- GuidsIdentification gvId = gv.getGuids(indexOfGv);\r
-\r
- //\r
- // First check if produced or not\r
- //\r
- if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
- isProduced = true;\r
- } else if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
- isProduced = false;\r
- }\r
-\r
- //\r
- // Get the sting "PackageName.ModuleName" \r
- //\r
- String tmp = "";\r
- if (gvId.getBelongModule() != null) {\r
- tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();\r
- }\r
-\r
- //\r
- // Check if the item has been added in\r
- // If added, append package name and new module name\r
- // If not added, add a new one first\r
- //\r
- for (int indexOfGuid = 0; indexOfGuid < guid.size(); indexOfGuid++) {\r
- GuidId guidId = guid.get(indexOfGuid);\r
-\r
- if (gvId.getName().equals(guidId.getName())) {\r
- if (isProduced) {\r
- guid.get(indexOfGuid).setProducedModules(guidId.getProducedModules() + "<br>" + tmp);\r
- } else if (!isProduced) {\r
- guid.get(indexOfGuid).setConsumedModules(guidId.getConsumedModules() + "<br>" + tmp);\r
- }\r
- isAdded = true;\r
- continue;\r
- }\r
- }\r
-\r
- //\r
- // Add a new one\r
- //\r
- if (!isAdded) {\r
- if (isProduced) {\r
- guid.addElement(new GuidId(gvId.getName(), "GUID", tmp, null, gvId.getDeclaredBy().getName()));\r
- } else if (!isProduced) {\r
- guid.addElement(new GuidId(gvId.getName(), "GUID", null, tmp, gvId.getDeclaredBy().getName()));\r
- }\r
- }\r
- }\r
-\r
- return guid;\r
- }\r
-\r
- /**\r
- Get all pcd coded entries from workspace\r
- \r
- @return\r
- \r
- **/\r
- public static PcdCodedVector getAllPcdCodedVector() {\r
- PcdCodedVector pv = new PcdCodedVector();\r
- ModuleSurfaceArea msa = null;\r
- ModuleIdentification mid = null;\r
- PcdCodedIdentification pid = null;\r
-\r
- //\r
- // Go through each module one by one\r
- //\r
- if (GlobalData.openingModuleList.size() > 0) {\r
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r
-\r
- if (msa.getPcdCoded() != null) {\r
- if (msa.getPcdCoded().getPcdEntryList().size() > 0) {\r
- for (int index = 0; index < msa.getPcdCoded().getPcdEntryList().size(); index++) {\r
-\r
- String arg0 = msa.getPcdCoded().getPcdEntryList().get(index).getCName();\r
- String arg1 = msa.getPcdCoded().getPcdEntryList().get(index).getTokenSpaceGuidCName();\r
-\r
- String arg2 = msa.getPcdCoded().getPcdEntryList().get(index).getFeatureFlag();\r
- Vector<String> arg3 = Tools.convertListToVector(msa.getPcdCoded().getPcdEntryList()\r
- .get(index).getSupArchList());\r
-\r
- String arg4 = msa.getPcdCoded().getPcdEntryList().get(index).getDefaultValue();\r
- String arg5 = msa.getPcdCoded().getPcdEntryList().get(index).getHelpText();\r
- String arg6 = null;\r
- if (msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType() != null) {\r
- arg6 = msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType().toString();\r
- }\r
- String arg7 = null;\r
- if (msa.getPcdCoded().getPcdEntryList().get(index).getUsage() != null) {\r
- arg7 = msa.getPcdCoded().getPcdEntryList().get(index).getUsage().toString();\r
- }\r
- pid = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\r
- pid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getPcdDeclarations() != null) {\r
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()\r
- .size(); indexOfPcds++) {\r
- PcdEntry pcdEntry = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);\r
- if (pcdEntry.getCName().equals(arg0)) {\r
- pid.setTokenSpaceGuidCName(pcdEntry.getTokenSpaceGuidCName());\r
- pid.setToken(pcdEntry.getToken().toString());\r
- pid.setDatumType(pcdEntry.getDatumType().toString());\r
- pid.setValue(pcdEntry.getDefaultValue());\r
- pid.setUsage(Tools.convertListToString(pcdEntry.getValidUsage()));\r
- pid.setHelp(pcdEntry.getHelpText());\r
- pid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (pid.getDeclaredBy() == null) {\r
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- pv.addPcdCoded(pid);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Go through all defined pcds to find which is not added yet.\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
- .getId();\r
- if (spd.getPcdDeclarations() != null) {\r
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds++) {\r
- boolean isFound = false;\r
- PcdEntry e = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- if (e.getCName().equals(pv.getPcdCoded(indexOfPv).getName())) {\r
- isFound = true;\r
- break;\r
- }\r
- }\r
- if (!isFound) {\r
- pid = new PcdCodedIdentification("", "", "", null, "", "", null, null);\r
- pid.setName(e.getCName());\r
- pid.setTokenSpaceGuidCName(e.getTokenSpaceGuidCName());\r
- pid.setToken(e.getToken().toString());\r
- pid.setDatumType(e.getDatumType().toString());\r
- pid.setValue(e.getDefaultValue());\r
- pid.setUsage(Tools.convertListToString(e.getValidUsage()));\r
- pid.setHelp(e.getHelpText());\r
- pid.setDeclaredBy(packageId);\r
-\r
- pid.setBelongModule(null);\r
- pv.addPcdCoded(pid);\r
- }\r
- }\r
- }\r
- }\r
- Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);\r
- return pv;\r
- }\r
-\r
- /**\r
- \r
- @param pv\r
- @return\r
- \r
- **/\r
- public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {\r
- Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();\r
- boolean isAdded = false;\r
- boolean isProduced = false;\r
-\r
- //\r
- // Go through pv to add item as new format to ppi one by one\r
- //\r
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
- isAdded = false;\r
- PcdCodedIdentification pvId = pv.getPcdCoded(indexOfPv);\r
-\r
- //\r
- // First check if produced or not\r
- //\r
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
- isProduced = true;\r
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
- isProduced = false;\r
- }\r
-\r
- //\r
- // Check if the item has been added in\r
- // If added, append package name and new module name\r
- // If not added, add a new one first\r
- //\r
- for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {\r
- PcdFindResultId pcdId = pcd.get(indexOfGuid);\r
-\r
- if (pvId.getName().equals(pcdId.getName())) {\r
- if (isProduced) {\r
- pcd.get(indexOfGuid).addProducedModules(pvId.getBelongModule());\r
- } else if (!isProduced) {\r
- pcd.get(indexOfGuid).addConsumedModules(pvId.getBelongModule());\r
- }\r
- isAdded = true;\r
- continue;\r
- }\r
- }\r
-\r
- //\r
- // Add a new one\r
- //\r
- if (!isAdded) {\r
- PcdFindResultId pcdId = new PcdFindResultId(pvId.getName(), "PCD", pvId.getSupArchList(),\r
- pvId.getHelp(), null, pvId.getDeclaredBy());\r
- pcdId.setTokenSpaceGuidCName(pvId.getTokenSpaceGuidCName());\r
- pcdId.setToken(pvId.getToken());\r
- pcdId.setDatumType(pvId.getDatumType());\r
- pcdId.setValue(pvId.getValue());\r
- pcdId.setUsage(pvId.getUsage());\r
-\r
- pcd.addElement(pcdId);\r
- }\r
- }\r
-\r
- return pcd;\r
- }\r
-\r
- /**\r
- Get all library class entries from workspace\r
- \r
- @return\r
- \r
- **/\r
- public static LibraryClassVector getAllLibraryClassVector() {\r
- LibraryClassVector lcv = new LibraryClassVector();\r
- ModuleSurfaceArea msa = null;\r
- ModuleIdentification mid = null;\r
- LibraryClassIdentification lcid = null;\r
-\r
- //\r
- // Go through each module one by one\r
- //\r
- if (GlobalData.openingModuleList.size() > 0) {\r
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {\r
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();\r
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();\r
-\r
- if (msa.getLibraryClassDefinitions() != null) {\r
- LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();\r
- if (lcd.getLibraryClassList().size() > 0) {\r
- for (int index = 0; index < lcd.getLibraryClassList().size(); index++) {\r
- String name = lcd.getLibraryClassList().get(index).getKeyword();\r
- String usage = null;\r
- if (lcd.getLibraryClassList().get(index).getUsage() != null) {\r
- usage = lcd.getLibraryClassList().get(index).getUsage().toString();\r
- }\r
- String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();\r
- String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();\r
- String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();\r
- Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)\r
- .getSupArchList());\r
- Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)\r
- .getSupModuleList());\r
- String help = lcd.getLibraryClassList().get(index).getHelpText();\r
- lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag,\r
- module, help);\r
- lcid.setBelongModule(mid);\r
-\r
- //\r
- // Find which package declares it\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList\r
- .getOpeningPackageByIndex(\r
- indexOfPackage)\r
- .getId();\r
- if (spd.getLibraryClassDeclarations() != null) {\r
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd\r
- .getLibraryClassDeclarations()\r
- .getLibraryClassList()\r
- .size(); indexOfLibraryClass++) {\r
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList()\r
- .get(indexOfLibraryClass);\r
- if (lc.getName().equals(name)) {\r
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r
- lcid.setHelp(lc.getHelpText());\r
- lcid.setDeclaredBy(packageId);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if (lcid.getDeclaredBy() == null) {\r
- lcid.setDeclaredBy(new PackageIdentification("", "", "", ""));\r
- }\r
-\r
- lcv.addLibraryClass(lcid);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- //\r
- // Go through all defined pcds to find which is not added yet.\r
- //\r
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
- .getId();\r
- if (spd.getLibraryClassDeclarations() != null) {\r
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd.getLibraryClassDeclarations()\r
- .getLibraryClassList().size(); indexOfLibraryClass++) {\r
- boolean isFound = false;\r
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);\r
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r
- if (lc.getName().equals(lcv.getLibraryClass(indexOfLcv).getLibraryClassName())) {\r
- isFound = true;\r
- break;\r
- }\r
- }\r
- if (!isFound) {\r
- lcid = new LibraryClassIdentification("", null, "", "", null, "", null, "");\r
- lcid.setLibraryClassName(lc.getName());\r
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r
- lcid.setHelp(lc.getHelpText());\r
- lcid.setDeclaredBy(packageId);\r
-\r
- lcid.setBelongModule(null);\r
- lcv.addLibraryClass(lcid);\r
- }\r
- }\r
- }\r
- }\r
- Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);\r
- return lcv;\r
- }\r
-\r
- /**\r
- Re-org all guid entries for find table\r
- \r
- @return\r
- \r
- **/\r
- public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {\r
- Vector<FindResultId> libraryClass = new Vector<FindResultId>();\r
- boolean isAdded = false;\r
- boolean isProduced = false;\r
-\r
- //\r
- // Go through pv to add item as new format to ppi one by one\r
- //\r
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r
- isAdded = false;\r
- LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);\r
-\r
- //\r
- // First check if produced or not\r
- //\r
- if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
- isProduced = true;\r
- } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
- isProduced = false;\r
- }\r
-\r
- //\r
- // Check if the item has been added in\r
- // If added, append package name and new module name\r
- // If not added, add a new one first\r
- //\r
- for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {\r
- FindResultId frId = libraryClass.get(indexOfGuid);\r
-\r
- if (lcvId.getLibraryClassName().equals(frId.getName())) {\r
- if (isProduced) {\r
- libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());\r
- } else if (!isProduced) {\r
- libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());\r
- }\r
- isAdded = true;\r
- continue;\r
- }\r
- }\r
-\r
- //\r
- // Add a new one\r
- //\r
- if (!isAdded) {\r
- libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",\r
- lcvId.getSupArchList(), lcvId.getHelp(),\r
- lcvId.getSupModuleList(), lcvId.getDeclaredBy()));\r
- }\r
- }\r
-\r
- return libraryClass;\r
- }\r
-}\r