summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e6225e3)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1182
6f19259b-4bc3-4df7-8a09-
765794883524
// 2), Loop all modules to process <PcdBuildDeclarations> for each module.\r
// -------------------------------------------------------------------\r
//\r
// 2), Loop all modules to process <PcdBuildDeclarations> for each module.\r
// -------------------------------------------------------------------\r
//\r
- for (index = 0; index < modules.size(); index ++) {\r
+ for (index = 0; index < modules.size(); index++) {\r
//\r
// It is legal for a module does not contains ANY pcd build definitions.\r
//\r
//\r
// It is legal for a module does not contains ANY pcd build definitions.\r
//\r
// 2.1), Loop all Pcd entry for a module and add it into memory database.\r
// ----------------------------------------------------------------------\r
//\r
// 2.1), Loop all Pcd entry for a module and add it into memory database.\r
// ----------------------------------------------------------------------\r
//\r
- for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex ++) {\r
+ for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex++) {\r
pcdBuildData = pcdBuildDataArray.get(pcdIndex);\r
\r
tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
pcdBuildData = pcdBuildDataArray.get(pcdIndex);\r
\r
tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
}\r
\r
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
}\r
\r
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
- pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
+ pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
tokenNumber = Long.decode(pcdBuildData.getToken().toString());\r
if (pcdBuildData.getValue() != null) {\r
datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
tokenNumber = Long.decode(pcdBuildData.getToken().toString());\r
if (pcdBuildData.getValue() != null) {\r
//\r
List<Token> tokenArray = getUnreferencedDynamicPcd();\r
if (tokenArray != null) {\r
//\r
List<Token> tokenArray = getUnreferencedDynamicPcd();\r
if (tokenArray != null) {\r
- for (index = 0; index < tokenArray.size(); index ++) {\r
+ for (index = 0; index < tokenArray.size(); index++) {\r
pcdDbManager.addTokenToDatabase(tokenArray.get(index).getPrimaryKeyString(),\r
tokenArray.get(index));\r
}\r
pcdDbManager.addTokenToDatabase(tokenArray.get(index).getPrimaryKeyString(),\r
tokenArray.get(index));\r
}\r
//\r
// Loop all sku data\r
//\r
//\r
// Loop all sku data\r
//\r
- for (index = 0; index < skuInfoList.size(); index ++) {\r
+ for (index = 0; index < skuInfoList.size(); index++) {\r
skuInstance = new SkuInstance();\r
//\r
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
skuInstance = new SkuInstance();\r
//\r
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
- for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2 ++) {\r
+ for (index2 = 0; index2 < dynamicPcdBuildDataArray.size(); index2++) {\r
pcdBuildData = dynamicPcdBuildDataArray.get(index2);\r
tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
pcdBuildData = dynamicPcdBuildDataArray.get(index2);\r
tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
- pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
+ pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
throw new EntityException (String.format("[FPD file error] It not allowed for DYNAMIC PCD %s who is no used by any module",\r
pcdBuildData.getCName()));\r
if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
throw new EntityException (String.format("[FPD file error] It not allowed for DYNAMIC PCD %s who is no used by any module",\r
pcdBuildData.getCName()));\r
//\r
// Loop all sku data\r
//\r
//\r
// Loop all sku data\r
//\r
- for (index = 0; index < skuInfoList.size(); index ++) {\r
+ for (index = 0; index < skuInfoList.size(); index++) {\r
skuInstance = new SkuInstance();\r
//\r
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
skuInstance = new SkuInstance();\r
//\r
// Although SkuId in schema is BigInteger, but in fact, sku id is 32 bit value.\r
//\r
// Remove blank space from these string and remove header string "0x"\r
//\r
//\r
// Remove blank space from these string and remove header string "0x"\r
//\r
- for (index = 0; index < 11; index ++) {\r
+ for (index = 0; index < 11; index++) {\r
splitStringArray[index] = splitStringArray[index].trim();\r
splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());\r
}\r
splitStringArray[index] = splitStringArray[index].trim();\r
splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());\r
}\r
//\r
// Add heading '0' to normalize the string length\r
//\r
//\r
// Add heading '0' to normalize the string length\r
//\r
- for (index = 3; index < 11; index ++) {\r
+ for (index = 3; index < 11; index++) {\r
chLen = splitStringArray[index].length();\r
chLen = splitStringArray[index].length();\r
- for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {\r
+ for (chIndex = 0; chIndex < 2 - chLen; chIndex++) {\r
splitStringArray[index] = "0" + splitStringArray[index];\r
}\r
}\r
splitStringArray[index] = "0" + splitStringArray[index];\r
}\r
}\r
(componentType < CommonDefinition.ComponentTypeNull)) {\r
return null;\r
}\r
(componentType < CommonDefinition.ComponentTypeNull)) {\r
return null;\r
}\r
- for (int index = 0; index < CommonDefinition.componentEnum.length; index ++) {\r
+ for (int index = 0; index < CommonDefinition.componentEnum.length; index++) {\r
if (componentType == CommonDefinition.componentEnum[index].type) {\r
return CommonDefinition.componentEnum[index].moduleTypeStr;\r
}\r
if (componentType == CommonDefinition.componentEnum[index].type) {\r
return CommonDefinition.componentEnum[index].moduleTypeStr;\r
}\r
\r
import org.tianocore.pcd.exception.EntityException;\r
\r
\r
import org.tianocore.pcd.exception.EntityException;\r
\r
-/** This class is to descript a value type of dynamic PCD.\r
- For a dynamic or dynamicEx type PCD data, the value type can be:\r
- 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.\r
- 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set\r
- by OEM.\r
- 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic\r
- database.\r
+/** \r
+ This class is to descript a value type of dynamic PCD.\r
+ For a dynamic or dynamicEx type PCD data, the value type can be:\r
+ 1) Hii type: the value of dynamic or dynamicEx is stored into a variable.\r
+ 2) Vpd type: the value of dynamic or dynamicEx is stored into somewhere set\r
+ by OEM.\r
+ 3) Default type: the value of dynamic or dynamicEx is stored into PCD dynamic\r
+ database.\r
**/\r
public class DynamicTokenValue {\r
///\r
/// Enumeration macro defintion for value type.\r
**/\r
public class DynamicTokenValue {\r
///\r
/// Enumeration macro defintion for value type.\r
- /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed\r
- /// in coding review.\r
public enum VALUE_TYPE {HII_TYPE, VPD_TYPE, DEFAULT_TYPE}\r
\r
public enum VALUE_TYPE {HII_TYPE, VPD_TYPE, DEFAULT_TYPE}\r
\r
+ ///\r
+ /// The value type maybe:\r
+ /// HII_TYPE: the value stored into variable area.\r
+ /// VPD_TYPE: the value stored into OEM specific area.\r
+ /// DEFAULT_TYPE: the value stored into PCD runtime database.\r
+ /// \r
public VALUE_TYPE type;\r
\r
///\r
/// ---------------------------------------------------------------------\r
public VALUE_TYPE type;\r
\r
///\r
/// ---------------------------------------------------------------------\r
- /// Following member is for HII case.\r
+ /// Following member is for HII case. The value of HII case will be put \r
+ /// into variable area in flash.\r
/// ---------------------------------------------------------------------\r
///\r
\r
/// ---------------------------------------------------------------------\r
///\r
\r
\r
///\r
/// ---------------------------------------------------------------------\r
\r
///\r
/// ---------------------------------------------------------------------\r
- /// Following member is for VPD case.\r
+ /// Following member is for VPD case. The value of VPD case will be put into\r
+ /// some flash position pointed by OEM.\r
/// ---------------------------------------------------------------------\r
///\r
/// ---------------------------------------------------------------------\r
///\r
public String vpdOffset;\r
\r
/// ---------------------------------------------------------------------\r
public String vpdOffset;\r
\r
/// ---------------------------------------------------------------------\r
- /// Following member is for default case.\r
+ /// Following member is for default case. The value of default type will\r
+ /// be put into PCD runtime database.\r
/// ---------------------------------------------------------------------\r
/// ---------------------------------------------------------------------\r
+\r
+ ///\r
+ /// The default value of this PCD in default case.\r
+ /// \r
public String value;\r
\r
/**\r
public String value;\r
\r
/**\r
BUGBUG: In fact, it is not correctly, variable name should be\r
treated as unicode UINT16 array.\r
\r
BUGBUG: In fact, it is not correctly, variable name should be\r
treated as unicode UINT16 array.\r
\r
- @return String\r
- */\r
+ @return String \r
+ **/\r
public String getStringOfVariableName()\r
throws EntityException {\r
String str;\r
int index, num;\r
public String getStringOfVariableName()\r
throws EntityException {\r
String str;\r
int index, num;\r
- str = "";\r
- for (index = 0; index < variableName.size(); index ++) {\r
+ str = "";\r
+ size = variableName.size();\r
+ for (index = 0; index < size; index++) {\r
num = Integer.decode(variableName.get(index).toString());\r
if ((num > 127 ) || (num < 0)) {\r
throw new EntityException(String.format("variable name contains >0x80 character, now is not support!"));\r
num = Integer.decode(variableName.get(index).toString());\r
if ((num > 127 ) || (num < 0)) {\r
throw new EntityException(String.format("variable name contains >0x80 character, now is not support!"));\r
/**\r
Set Vpd case data.\r
\r
/**\r
Set Vpd case data.\r
\r
- @param vpdOffset\r
- */\r
+ @param vpdOffset the value offset the start address of OEM specific.\r
+ **/\r
public void setVpdData(String vpdOffset) {\r
this.type = VALUE_TYPE.VPD_TYPE;\r
\r
public void setVpdData(String vpdOffset) {\r
this.type = VALUE_TYPE.VPD_TYPE;\r
\r
Set default case data.\r
\r
@param value\r
Set default case data.\r
\r
@param value\r
public void setValue(String value) {\r
this.type = VALUE_TYPE.DEFAULT_TYPE;\r
\r
public void setValue(String value) {\r
this.type = VALUE_TYPE.DEFAULT_TYPE;\r
\r
\r
///\r
/// Before build a module, the used libary will be build firstly, the PCD of these\r
\r
///\r
/// Before build a module, the used libary will be build firstly, the PCD of these\r
- /// libarry is inheritted by the module, so stored module's PCD information as PCD\r
+ /// library is inheritted by the module, so stored module's PCD information as PCD\r
/// context of building libary.\r
///\r
public static List<UsageInstance> UsageInstanceContext = null;\r
/// context of building libary.\r
///\r
public static List<UsageInstance> UsageInstanceContext = null;\r
Object[] dataArray = null;\r
Map.Entry entry = null;\r
int index = 0;\r
Object[] dataArray = null;\r
Map.Entry entry = null;\r
int index = 0;\r
\r
if (memoryDatabase == null) {\r
return null;\r
}\r
\r
if (memoryDatabase == null) {\r
return null;\r
}\r
dataArray = memoryDatabase.entrySet().toArray();\r
dataArray = memoryDatabase.entrySet().toArray();\r
+ size = memoryDatabase.size();\r
tokenArray = new Token[memoryDatabase.size()];\r
tokenArray = new Token[memoryDatabase.size()];\r
- for (index = 0; index < memoryDatabase.size(); index ++) {\r
+ for (index = 0; index < size; index++) {\r
entry =(Map.Entry) dataArray [index];\r
tokenArray[index] =(Token) entry.getValue();\r
}\r
entry =(Map.Entry) dataArray [index];\r
tokenArray[index] =(Token) entry.getValue();\r
}\r
return tokenArray;\r
}\r
\r
/**\r
Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.\r
\r
return tokenArray;\r
}\r
\r
/**\r
Get record array only contains DYNAMIC or DYNAMIC_EX type PCD.\r
\r
- @return ArrayList\r
- */\r
+ @return ArrayList the array list contains all dynamic type PCD.\r
+ **/\r
private ArrayList getDynamicRecordArray() {\r
Token[] tokenArray = getRecordArray();\r
int index = 0;\r
private ArrayList getDynamicRecordArray() {\r
Token[] tokenArray = getRecordArray();\r
int index = 0;\r
ArrayList tokenArrayList = getDynamicRecordArray();\r
Object[] usageInstanceArray = null;\r
UsageInstance usageInstance = null;\r
ArrayList tokenArrayList = getDynamicRecordArray();\r
Object[] usageInstanceArray = null;\r
UsageInstance usageInstance = null;\r
+ int size = 0;\r
+ int consumerSize = 0;\r
- //pei = new ArrayList<Token>();\r
- //dxe = new ArrayList<Token>();\r
-\r
- for (index = 0; index < tokenArrayList.size(); index++) {\r
+ size = tokenArrayList.size();\r
+ for (index = 0; index < size; index++) {\r
boolean found = false;\r
Token token = (Token) tokenArrayList.get(index);\r
if (token.consumers != null) {\r
usageInstanceArray = token.consumers.entrySet().toArray();\r
boolean found = false;\r
Token token = (Token) tokenArrayList.get(index);\r
if (token.consumers != null) {\r
usageInstanceArray = token.consumers.entrySet().toArray();\r
- for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {\r
+ consumerSize = token.consumers.size();\r
+ for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {\r
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());\r
if (usageInstance.isPeiPhaseComponent()) {\r
pei.add(token);\r
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());\r
if (usageInstance.isPeiPhaseComponent()) {\r
pei.add(token);\r
if (!found) {\r
if (token.consumers != null) {\r
usageInstanceArray = token.consumers.entrySet().toArray();\r
if (!found) {\r
if (token.consumers != null) {\r
usageInstanceArray = token.consumers.entrySet().toArray();\r
- for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {\r
+ consumerSize = token.consumers.size();\r
+ for (usageInstanceIndex = 0; usageInstanceIndex < consumerSize; usageInstanceIndex++) {\r
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());\r
if (usageInstance.isDxePhaseComponent()) {\r
dxe.add(token);\r
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());\r
if (usageInstance.isDxePhaseComponent()) {\r
dxe.add(token);\r
\r
@param primaryKey the primary key of usage instance.\r
\r
\r
@param primaryKey the primary key of usage instance.\r
\r
- @return List<UsageInstance>\r
- */\r
+ @return List<UsageInstance> the list contains all usage instances.\r
+ **/\r
public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {\r
Token[] tokenArray = null;\r
int recordIndex = 0;\r
public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {\r
Token[] tokenArray = null;\r
int recordIndex = 0;\r
//\r
// Loop to find all PCD record related to current module\r
//\r
//\r
// Loop to find all PCD record related to current module\r
//\r
- for (recordIndex = 0; recordIndex < getDBSize(); recordIndex ++) {\r
+ for (recordIndex = 0; recordIndex < getDBSize(); recordIndex++) {\r
if (tokenArray[recordIndex].consumers.size() != 0) {\r
usageInstance = tokenArray[recordIndex].consumers.get(primaryKey);\r
if (usageInstance != null) {\r
if (tokenArray[recordIndex].consumers.size() != 0) {\r
usageInstance = tokenArray[recordIndex].consumers.get(primaryKey);\r
if (usageInstance != null) {\r
**/\r
public List<String> getAllModuleArray()\r
{\r
**/\r
public List<String> getAllModuleArray()\r
{\r
int usageIndex = 0;\r
int moduleIndex = 0;\r
Token[] tokenArray = null;\r
int usageIndex = 0;\r
int moduleIndex = 0;\r
Token[] tokenArray = null;\r
List<String> moduleNames = new ArrayList<String>();\r
UsageInstance usageInstance = null;\r
boolean bFound = false;\r
List<String> moduleNames = new ArrayList<String>();\r
UsageInstance usageInstance = null;\r
boolean bFound = false;\r
+ String primaryKey = null;\r
\r
tokenArray = getRecordArray();\r
//\r
// Find all consumer usage instance for retrieving module's name\r
//\r
\r
tokenArray = getRecordArray();\r
//\r
// Find all consumer usage instance for retrieving module's name\r
//\r
- for (indexToken = 0; indexToken < getDBSize(); indexToken ++) {\r
- usageInstanceArray = tokenArray[indexToken].consumers.entrySet().toArray();\r
- for (usageIndex = 0; usageIndex < tokenArray[indexToken].consumers.size(); usageIndex ++) {\r
+ for (tokenIndex = 0; tokenIndex < getDBSize(); tokenIndex++) {\r
+ usageInstanceArray = tokenArray[tokenIndex].consumers.entrySet().toArray();\r
+ for (usageIndex = 0; usageIndex < tokenArray[tokenIndex].consumers.size(); usageIndex++) {\r
usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();\r
usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();\r
+ primaryKey = usageInstance.getPrimaryKey();\r
- for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex ++) {\r
- if (moduleNames.get(moduleIndex).equalsIgnoreCase(usageInstance.getPrimaryKey())) {\r
+ for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex++) {\r
+ if (moduleNames.get(moduleIndex).equalsIgnoreCase(primaryKey)) {\r
bFound = true;\r
break;\r
}\r
}\r
if (!bFound) {\r
bFound = true;\r
break;\r
}\r
}\r
if (!bFound) {\r
- moduleNames.add(usageInstance.getPrimaryKey());\r
+ moduleNames.add(primaryKey);\r
**/ \r
package org.tianocore.pcd.entity;\r
\r
**/ \r
package org.tianocore.pcd.entity;\r
\r
-/** Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.\r
+/** \r
+ Sku instance contains ID and value, A pcd token maybe contains more than one Sku instance.\r
**/\r
public class SkuInstance {\r
///\r
**/\r
public class SkuInstance {\r
///\r
@param pcdType new PCD type found in FPD file for this token.\r
**/\r
public void updateSupportPcdType(PCD_TYPE pcdType) {\r
@param pcdType new PCD type found in FPD file for this token.\r
**/\r
public void updateSupportPcdType(PCD_TYPE pcdType) {\r
- for (int index = 0; index < this.supportedPcdType.size(); index ++) {\r
+ int size = supportedPcdType.size();\r
+ for (int index = 0; index < size; index++) {\r
if (supportedPcdType.get(index) == pcdType) {\r
return;\r
}\r
if (supportedPcdType.get(index) == pcdType) {\r
return;\r
}\r
@param pcdType the judged pcd type\r
\r
@return boolean\r
@param pcdType the judged pcd type\r
\r
@return boolean\r
public static boolean isDynamic(PCD_TYPE pcdType) {\r
if ((pcdType == PCD_TYPE.DYNAMIC ) ||\r
(pcdType == PCD_TYPE.DYNAMIC_EX)) {\r
public static boolean isDynamic(PCD_TYPE pcdType) {\r
if ((pcdType == PCD_TYPE.DYNAMIC ) ||\r
(pcdType == PCD_TYPE.DYNAMIC_EX)) {\r
+ /**\r
+ The pcd type is DynamicEx?\r
+ \r
+ @retval true Is DynamicEx type\r
+ @retval false not DynamicEx type\r
+ **/\r
public boolean isDynamicEx() {\r
public boolean isDynamicEx() {\r
- for (int i = 0; i < supportedPcdType.size(); i++) {\r
+ int size = supportedPcdType.size();\r
+ for (int i = 0; i < size; i++) {\r
if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {\r
return true;\r
}\r
if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {\r
return true;\r
}\r
If skudata list contains more than one data, then Sku mechanism is enable.\r
\r
@retval boolean if the number of sku data exceed to 1\r
If skudata list contains more than one data, then Sku mechanism is enable.\r
\r
@retval boolean if the number of sku data exceed to 1\r
public boolean isSkuEnable() {\r
if (this.skuData.size() > 1) {\r
return true;\r
public boolean isSkuEnable() {\r
if (this.skuData.size() > 1) {\r
return true;\r
Get the token primary key in token database.\r
\r
@return String\r
Get the token primary key in token database.\r
\r
@return String\r
public String getPrimaryKeyString () {\r
return Token.getPrimaryKeyString(cName, tokenSpaceName);\r
}\r
public String getPrimaryKeyString () {\r
return Token.getPrimaryKeyString(cName, tokenSpaceName);\r
}\r
@param usageId The UsageInstance identification for usage instance\r
\r
@return boolean whether exist an usage instance for this token.\r
@param usageId The UsageInstance identification for usage instance\r
\r
@return boolean whether exist an usage instance for this token.\r
public boolean isUsageInstanceExist(UsageIdentification usageId) {\r
String keyStr = UsageInstance.getPrimaryKey(usageId);\r
\r
public boolean isUsageInstanceExist(UsageIdentification usageId) {\r
String keyStr = UsageInstance.getPrimaryKey(usageId);\r
\r
\r
@return PCD_TYPE\r
**/\r
\r
@return PCD_TYPE\r
**/\r
- public static PCD_TYPE getpcdTypeFromString(String pcdTypeStr) {\r
+ public static PCD_TYPE getPcdTypeFromString(String pcdTypeStr) {\r
if (pcdTypeStr == null) {\r
return PCD_TYPE.UNKNOWN;\r
}\r
if (pcdTypeStr == null) {\r
return PCD_TYPE.UNKNOWN;\r
}\r
@return The string of datum type.\r
**/\r
public static String getStringOfdatumType(DATUM_TYPE datumType) {\r
@return The string of datum type.\r
**/\r
public static String getStringOfdatumType(DATUM_TYPE datumType) {\r
- switch (datumType) {\r
- case UINT8:\r
- return "UINT8";\r
- case UINT16:\r
- return "UINT16";\r
- case UINT32:\r
- return "UINT32";\r
- case UINT64:\r
- return "UINT64";\r
- case POINTER:\r
- return "POINTER";\r
- case BOOLEAN:\r
- return "BOOLEAN";\r
- }\r
- return "UNKNOWN";\r
+ return datumType.toString();\r
@return The string of PCD_TYPE.\r
**/\r
public static String getStringOfpcdType(PCD_TYPE pcdType) {\r
@return The string of PCD_TYPE.\r
**/\r
public static String getStringOfpcdType(PCD_TYPE pcdType) {\r
- switch (pcdType) {\r
- case FEATURE_FLAG:\r
- return "FEATURE_FLAG";\r
- case FIXED_AT_BUILD:\r
- return "FIXED_AT_BUILD";\r
- case PATCHABLE_IN_MODULE:\r
- return "PATCHABLE_IN_MODULE";\r
- case DYNAMIC:\r
- return "DYNAMIC";\r
- case DYNAMIC_EX:\r
- return "DYNAMIC_EX";\r
- }\r
- return "UNKNOWN";\r
+ return pcdType.toString();\r
@return The string of PDC_USAGE.\r
**/\r
public static String getStringOfUsage(PCD_USAGE usage) {\r
@return The string of PDC_USAGE.\r
**/\r
public static String getStringOfUsage(PCD_USAGE usage) {\r
- switch (usage) {\r
- case ALWAYS_PRODUCED:\r
- return "ALWAYS_PRODUCED";\r
- case ALWAYS_CONSUMED:\r
- return "ALWAYS_CONSUMED";\r
- case SOMETIMES_PRODUCED:\r
- return "SOMETIMES_PRODUCED";\r
- case SOMETIMES_CONSUMED:\r
- return "SOMETIMES_CONSUMED";\r
- }\r
- return "UNKNOWN";\r
+ return usage.toString();\r
@retval DynamicTokenValue the value of this dyanmic token.\r
**/\r
public DynamicTokenValue getDefaultSku() {\r
@retval DynamicTokenValue the value of this dyanmic token.\r
**/\r
public DynamicTokenValue getDefaultSku() {\r
- int index;\r
-\r
- for (index = 0; index < this.skuData.size(); index ++) {\r
+ int index;\r
+ int size = skuData.size();\r
+ for (index = 0; index < size; index++) {\r
if (skuData.get(index).id == 0) {\r
return skuData.get(index).value;\r
}\r
if (skuData.get(index).id == 0) {\r
return skuData.get(index).value;\r
}\r
Get the size of PCD value, this PCD is POINTER type.\r
\r
@param str the string of the value\r
Get the size of PCD value, this PCD is POINTER type.\r
\r
@param str the string of the value\r
+ @param al the array list for outer parameter.\r
**/\r
private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
if (isValidNullValue(str)) {\r
**/\r
private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
if (isValidNullValue(str)) {\r
SKU 0 will be returned; For Default type, the defaultvalue of default SKU\r
0 will be returned.\r
\r
SKU 0 will be returned; For Default type, the defaultvalue of default SKU\r
0 will be returned.\r
\r
- @return String\r
- */\r
+ @return String get the default value for a DYNAMIC type PCD.\r
+ **/\r
public String getDynamicDefaultValue() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
if (hasDefaultValue()) {\r
public String getDynamicDefaultValue() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
if (hasDefaultValue()) {\r
- //\r
- // BugBug: We need change this algorithm accordingly when schema is updated\r
- // to support no default value.\r
- //\r
+ /**\r
+ Judge whether a DYNAMIC PCD has default value. \r
+\r
+ @return whether a DYNAMIC PCD has default value.\r
+ **/\r
public boolean hasDefaultValue () {\r
DynamicTokenValue dynamicValue = null;\r
\r
public boolean hasDefaultValue () {\r
DynamicTokenValue dynamicValue = null;\r
\r
/**\r
Judge the value is NULL value. NULL value means the value is uninitialized value\r
\r
/**\r
Judge the value is NULL value. NULL value means the value is uninitialized value\r
\r
+ @param judgedValue the want want to be judged\r
- @return boolean\r
- */\r
+ @return boolean whether the value of PCD is NULL.\r
+ **/\r
public boolean isValidNullValue(String judgedValue) {\r
String subStr;\r
BigInteger bigIntValue;\r
public boolean isValidNullValue(String judgedValue) {\r
String subStr;\r
BigInteger bigIntValue;\r
}\r
break;\r
case POINTER:\r
}\r
break;\r
case POINTER:\r
- if (judgedValue.equalsIgnoreCase("") ||\r
- judgedValue.equalsIgnoreCase("\"\"") ||\r
+ if (judgedValue.equalsIgnoreCase("\"\"") ||\r
judgedValue.equalsIgnoreCase("L\"\"") ||\r
judgedValue.equalsIgnoreCase("L\"\"") ||\r
- (judgedValue.length() == 0) ||\r
- judgedValue.equalsIgnoreCase("{0}")) {\r
+ (judgedValue.length() == 0)) {\r
+ } else if (judgedValue.trim().charAt(0) == '{') {\r
+ int start = judgedValue.indexOf('{');\r
+ int end = judgedValue.lastIndexOf('}');\r
+ String[] strValueArray = judgedValue.substring(start + 1, end).split(",");\r
+ if (strValueArray.length > 1) {\r
+ return false;\r
+ } else {\r
+ if (strValueArray[0].matches("(0x)?(0X)?0*")) {\r
+ return true;\r
+ }\r
+ }\r
/**\r
Is the string value in Unicode\r
\r
/**\r
Is the string value in Unicode\r
\r
+ @return boolean the string value is UNICODE type string.\r
**/\r
public boolean isHiiDefaultValueUnicodeStringType() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
**/\r
public boolean isHiiDefaultValueUnicodeStringType() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
/**\r
Is the string value in ANSCI\r
\r
/**\r
Is the string value in ANSCI\r
\r
+ @return boolean whether the dfault value for HII case is string type.\r
**/\r
public boolean isHiiDefaultValueASCIIStringType() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
**/\r
public boolean isHiiDefaultValueASCIIStringType() {\r
DynamicTokenValue dynamicData = getDefaultSku();\r
\r
/**\r
Judege whether current value is UNICODE string type.\r
\r
/**\r
Judege whether current value is UNICODE string type.\r
- @return boolean\r
- */\r
+\r
+ @return boolean whether the value is UNICODE string.\r
+ **/\r
public boolean isUnicodeStringType () {\r
String str = getDynamicDefaultValue();\r
\r
public boolean isUnicodeStringType () {\r
String str = getDynamicDefaultValue();\r
\r
+ /**\r
+ Judge whether the string type is ANSIC string.\r
+\r
+ @return boolean whether the string type is ANSIC string\r
+ **/\r
public boolean isASCIIStringType () {\r
String str = getDynamicDefaultValue();\r
\r
public boolean isASCIIStringType () {\r
String str = getDynamicDefaultValue();\r
\r
+ /**\r
+ Judge whether the string value is byte array.\r
+\r
+ @return boolean whether the string value is byte array.\r
+\r
+ **/\r
public boolean isByteStreamType () {\r
String str = getDynamicDefaultValue();\r
\r
public boolean isByteStreamType () {\r
String str = getDynamicDefaultValue();\r
\r
+ /**\r
+ Get string value for ANSIC string type\r
+ \r
+ @return String the string value\r
+ **/\r
public String getStringTypeString () {\r
return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r
}\r
public String getStringTypeString () {\r
return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);\r
}\r
Constructure function for UsageInstance\r
\r
@param parentToken The token instance for this usgaInstance\r
Constructure function for UsageInstance\r
\r
@param parentToken The token instance for this usgaInstance\r
- @param id The identification for usage instance\r
+ @param usageId The identification for usage instance\r
@param modulePcdType The PCD type for this usage instance\r
@param value The value of this PCD in this usage instance\r
@param maxDatumSize The max datum size of this PCD in this usage\r
@param modulePcdType The PCD type for this usage instance\r
@param value The value of this PCD in this usage instance\r
@param maxDatumSize The max datum size of this PCD in this usage\r