]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Modify code according to Wang, jian's comments.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Aug 2006 05:56:42 +0000 (05:56 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Aug 2006 05:56:42 +0000 (05:56 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1182 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/CommonDefinition.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/DynamicTokenValue.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/SkuInstance.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java

index f455a9bce0db231ba9d133141602d9cf186be360..90c9ca0f31d774acf3259697f86f37cb190c8530 100644 (file)
@@ -162,7 +162,7 @@ public abstract class PlatformPcdPreprocessAction {
         // 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
@@ -179,7 +179,7 @@ public abstract class PlatformPcdPreprocessAction {
             // 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
@@ -189,7 +189,7 @@ public abstract class PlatformPcdPreprocessAction {
                 }\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
@@ -372,7 +372,7 @@ public abstract class PlatformPcdPreprocessAction {
         //\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
@@ -459,7 +459,7 @@ public abstract class PlatformPcdPreprocessAction {
         //\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
@@ -633,7 +633,7 @@ public abstract class PlatformPcdPreprocessAction {
             return null;\r
         }\r
 \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
@@ -648,7 +648,7 @@ public abstract class PlatformPcdPreprocessAction {
                 continue;\r
             }\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
@@ -681,7 +681,7 @@ public abstract class PlatformPcdPreprocessAction {
             //\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
@@ -870,7 +870,7 @@ public abstract class PlatformPcdPreprocessAction {
             //\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
@@ -878,9 +878,9 @@ public abstract class PlatformPcdPreprocessAction {
             //\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
-                for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {\r
+                for (chIndex = 0; chIndex < 2 - chLen; chIndex++) {\r
                     splitStringArray[index] = "0" + splitStringArray[index];\r
                 }\r
             }\r
index aef640c60821e5f430a4bb67e40d0ce19c304bf0..e2df2357bbfd49ca7b6ca47bd9c776a07df39586 100644 (file)
@@ -239,7 +239,7 @@ public class CommonDefinition {
           (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
index 175fb1a7f5cdab24537d53effdbd13452548e963..2de993d5111d9242ff12b2f85163b813cea77546 100644 (file)
@@ -20,26 +20,33 @@ import java.util.UUID;
 \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
-    /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed\r
-    ///         in coding review.\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
-    /// 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
@@ -66,14 +73,21 @@ public class DynamicTokenValue {
 \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
     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
+    /// The default value of this PCD in default case.\r
+    /// \r
     public String      value;\r
 \r
     /**\r
@@ -116,15 +130,17 @@ public class DynamicTokenValue {
        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
+        int    size;\r
 \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
@@ -138,8 +154,8 @@ public class DynamicTokenValue {
     /**\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
@@ -150,7 +166,7 @@ public class DynamicTokenValue {
        Set default case data.\r
 \r
        @param value\r
-     */\r
+    **/\r
     public void setValue(String value) {\r
         this.type = VALUE_TYPE.DEFAULT_TYPE;\r
 \r
index 90d0db4aaa62599ebed0b0057316e471a28a9c5b..ba0e3ca22955b9a3c36206522c166433fff56715 100644 (file)
@@ -35,7 +35,7 @@ public class MemoryDatabaseManager {
 \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
@@ -118,26 +118,26 @@ public class MemoryDatabaseManager {
         Object[]    dataArray   = null;\r
         Map.Entry   entry       = null;\r
         int         index       = 0;\r
+        int         size        = 0;\r
 \r
         if (memoryDatabase == null) {\r
             return null;\r
         }\r
-\r
         dataArray  = memoryDatabase.entrySet().toArray();\r
+        size       = 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
-\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
@@ -167,16 +167,17 @@ public class MemoryDatabaseManager {
         ArrayList               tokenArrayList      =   getDynamicRecordArray();\r
         Object[]                usageInstanceArray  =   null;\r
         UsageInstance           usageInstance       =   null;\r
+        int                     size                =   0;\r
+        int                     consumerSize        =   0;\r
 \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
-                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
@@ -193,7 +194,8 @@ public class MemoryDatabaseManager {
             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
@@ -216,8 +218,6 @@ public class MemoryDatabaseManager {
                 }\r
             }\r
         }\r
-\r
-        return;\r
     }\r
 \r
     /**\r
@@ -240,8 +240,8 @@ public class MemoryDatabaseManager {
 \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
@@ -253,7 +253,7 @@ public class MemoryDatabaseManager {
         //\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
@@ -272,7 +272,7 @@ public class MemoryDatabaseManager {
     **/\r
     public List<String> getAllModuleArray()\r
     {\r
-        int                       indexToken    = 0;\r
+        int                       tokenIndex    = 0;\r
         int                       usageIndex    = 0;\r
         int                       moduleIndex   = 0;\r
         Token[]                   tokenArray    = null;\r
@@ -280,24 +280,26 @@ public class MemoryDatabaseManager {
         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
-        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
+                primaryKey    = usageInstance.getPrimaryKey();\r
                 bFound        = false;\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
-                    moduleNames.add(usageInstance.getPrimaryKey());\r
+                    moduleNames.add(primaryKey);\r
                 }\r
             }\r
         }\r
index f6292d7820843cf9e52f38026d4be652479cb05d..6e666ba84f6c6163dff42e28b96fd115e7fefa28 100644 (file)
@@ -15,7 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/ \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
index 8429dfd0036ca8ee114f02739370739b4c7f954a..d1867fba5bc76df5514f45f4ad33e72f644a0345 100644 (file)
@@ -137,7 +137,8 @@ public class Token {
       @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
@@ -156,7 +157,7 @@ public class Token {
        @param pcdType       the judged pcd type\r
 \r
        @return boolean\r
-     */\r
+    **/\r
     public static boolean isDynamic(PCD_TYPE pcdType) {\r
         if ((pcdType == PCD_TYPE.DYNAMIC   ) ||\r
             (pcdType == PCD_TYPE.DYNAMIC_EX)) {\r
@@ -166,8 +167,15 @@ public class Token {
         return false;\r
     }\r
 \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
-        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
@@ -196,7 +204,7 @@ public class Token {
        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
-     */\r
+    **/\r
     public boolean isSkuEnable() {\r
         if (this.skuData.size() > 1) {\r
             return true;\r
@@ -232,7 +240,7 @@ public class Token {
        Get the token primary key in token database.\r
 \r
        @return String\r
-     */\r
+    **/\r
     public String getPrimaryKeyString () {\r
         return Token.getPrimaryKeyString(cName, tokenSpaceName);\r
     }\r
@@ -303,7 +311,7 @@ public class Token {
        @param usageId       The UsageInstance identification for usage instance\r
 \r
        @return boolean      whether exist an usage instance for this token.\r
-     */\r
+    **/\r
     public boolean isUsageInstanceExist(UsageIdentification usageId) {\r
         String keyStr = UsageInstance.getPrimaryKey(usageId);\r
 \r
@@ -317,7 +325,7 @@ public class Token {
 \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
@@ -345,21 +353,7 @@ public class Token {
       @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
     }\r
 \r
     /**\r
@@ -394,19 +388,7 @@ public class Token {
       @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
     }\r
 \r
     /**\r
@@ -442,17 +424,7 @@ public class Token {
       @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
     }\r
 \r
     /**\r
@@ -540,9 +512,9 @@ public class Token {
        @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
@@ -564,7 +536,7 @@ public class Token {
        Get the size of PCD value, this PCD is POINTER type.\r
 \r
        @param str   the string of the value\r
-       @param al\r
+       @param al    the array list for outer parameter.\r
     **/\r
     private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
         if (isValidNullValue(str)) {\r
@@ -644,8 +616,8 @@ public class Token {
        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
@@ -658,10 +630,11 @@ public class Token {
         return null;\r
     }\r
 \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
@@ -687,10 +660,10 @@ public class Token {
     /**\r
        Judge the value is NULL value. NULL value means the value is uninitialized value\r
 \r
-       @param judgedValue\r
+       @param judgedValue   the want want to be judged\r
 \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
@@ -742,12 +715,21 @@ public class Token {
             }\r
             break;\r
         case POINTER:\r
-            if (judgedValue.equalsIgnoreCase("")        ||\r
-                judgedValue.equalsIgnoreCase("\"\"")   ||\r
+            if (judgedValue.equalsIgnoreCase("\"\"")   ||\r
                 judgedValue.equalsIgnoreCase("L\"\"")   ||\r
-                (judgedValue.length() == 0)             ||\r
-                judgedValue.equalsIgnoreCase("{0}")) {\r
+                (judgedValue.length() == 0)) {\r
                 return true;\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
         }\r
         return false;\r
@@ -756,7 +738,7 @@ public class Token {
     /**\r
        Is the string value in Unicode\r
 \r
-       @return boolean\r
+       @return boolean the string value is UNICODE type string.\r
     **/\r
     public boolean isHiiDefaultValueUnicodeStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
@@ -771,7 +753,7 @@ public class Token {
     /**\r
        Is the string value in ANSCI\r
 \r
-       @return boolean\r
+       @return boolean whether the dfault value for HII case is string type.\r
     **/\r
     public boolean isHiiDefaultValueASCIIStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
@@ -785,8 +767,9 @@ public class Token {
 \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
@@ -803,6 +786,11 @@ public class Token {
         return false;\r
     }\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
@@ -819,6 +807,12 @@ public class Token {
         return false;\r
     }\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
@@ -836,6 +830,11 @@ public class Token {
 \r
     }\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
index 6fc66055eb8043bd8ba80e98cb22e1af4044de43..47638bcea6defbe2a265fdb28c73f7bc36a5cc78 100644 (file)
@@ -72,7 +72,7 @@ public class UsageInstance {
        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