]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/PcdTools/org/tianocore/pcd/entity/Token.java
Fixed grammar in messages.
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / entity / Token.java
index 2e2a297aa025c591566fa339eaaa6518d93baaf9..ed717421f078f268915fdd5a5615e7b8b42f758b 100644 (file)
@@ -2,17 +2,17 @@
   Token class.\r
 \r
   This module contains all classes releted to PCD token.\r
\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
+\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
+**/\r
 package org.tianocore.pcd.entity;\r
 \r
 import java.math.BigInteger;\r
@@ -20,33 +20,29 @@ import java.util.ArrayList;
 import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
-import java.util.UUID;\r
-\r
-import org.tianocore.pcd.entity.UsageIdentification;\r
-import org.tianocore.pcd.exception.EntityException;\r
 \r
-/** This class is to descript a PCD token object. The information of a token mainly \r
-    comes from MSA, SPD and setting produced by platform developer. \r
+/**\r
+   This class is to descript a PCD token object. The information of a token mainly\r
+   comes from MSA, SPD and setting produced by platform developer.\r
 **/\r
 public class Token {\r
     ///\r
     /// Enumeration macro defintion for PCD type.\r
-    /// BUGBUG: Not use upcase charater is to facility for reading. It may be changed\r
-    ///         in coding review.\r
-    public enum             PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC, \r
+    ///\r
+    public static enum      PCD_TYPE {FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODULE, DYNAMIC,\r
                                       DYNAMIC_EX, UNKNOWN}\r
 \r
     ///\r
     /// Enumeration macro definition for datum type. All type mainly comes from ProcessBind.h.\r
-    /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in \r
+    /// Wizard maybe expand this type as "int, unsigned int, short, unsigned short etc" in\r
     /// prompt dialog.\r
     ///\r
-    public enum             DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}\r
+    public static enum      DATUM_TYPE {UINT8, UINT16, UINT32, UINT64, BOOLEAN, POINTER, UNKNOWN}\r
 \r
     ///\r
     /// Enumeration macor defintion for usage of PCD\r
     ///\r
-    public enum             PCD_USAGE {ALWAYS_PRODUCED, ALWAYS_CONSUMED, SOMETIMES_PRODUCED,\r
+    public static enum      PCD_USAGE {ALWAYS_PRODUCED, ALWAYS_CONSUMED, SOMETIMES_PRODUCED,\r
                                        SOMETIMES_CONSUMED, UNKNOWN}\r
 \r
     ///\r
@@ -57,7 +53,7 @@ public class Token {
 \r
     ///\r
     /// Token space name is the guid defined by token itself in package or module level. This\r
-    /// name mainly for DynamicEx type. For other PCD type token, his token space name is the \r
+    /// name mainly for DynamicEx type. For other PCD type token, his token space name is the\r
     /// assignedtokenSpaceName as follows.\r
     /// tokenSpaceName is defined in MSA, SPD, FPD, can be regarded as primary key with cName.\r
     ///\r
@@ -71,24 +67,24 @@ public class Token {
     public long             tokenNumber;\r
 \r
     ///\r
-    /// This token number is retrieved from FPD file for DynamicEx type. \r
-    /// \r
+    /// This token number is retrieved from FPD file for DynamicEx type.\r
+    ///\r
     public long             dynamicExTokenNumber;\r
 \r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
     /// Currently, only record all PCD type for this token in FPD file.\r
-    /// \r
+    ///\r
     public List<PCD_TYPE>   supportedPcdType;\r
 \r
     ///\r
     /// If the token's item type is Dynamic or DynamicEx type, isDynamicPCD\r
     /// is true.\r
-    /// \r
+    ///\r
     public boolean          isDynamicPCD;\r
 \r
     ///\r
-    /// datumSize is to descript the fix size or max size for this token. \r
+    /// datumSize is to descript the fix size or max size for this token.\r
     /// datumSize is defined in SPD.\r
     ///\r
     public int              datumSize;\r
@@ -102,7 +98,7 @@ public class Token {
 \r
     ///\r
     /// skuData contains all value for SkuNumber of token.\r
-    /// This field is for Dynamic or DynamicEx type PCD, \r
+    /// This field is for Dynamic or DynamicEx type PCD,\r
     ///\r
     public List<SkuInstance> skuData;\r
 \r
@@ -113,7 +109,7 @@ public class Token {
 \r
     /**\r
        Constructure function for Token class\r
-       \r
+\r
        @param cName             The name of token\r
        @param tokenSpaceName    The name of token space, it is a guid string\r
     **/\r
@@ -131,14 +127,15 @@ public class Token {
 \r
     /**\r
       updateSupportPcdType\r
-      \r
+\r
       SupportPcdType should be gotten from SPD file actually, but now it just\r
       record all PCD type for this token in FPD file.\r
-      \r
+\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
@@ -146,18 +143,18 @@ public class Token {
 \r
         //\r
         // If not found, add the pcd type to member variable supportedPcdType\r
-        // \r
+        //\r
         supportedPcdType.add(pcdType);\r
     }\r
 \r
     /**\r
        Judge whether pcdType is belong to dynamic type. Dynamic type includes\r
        DYNAMIC and DYNAMIC_EX.\r
-       \r
+\r
        @param pcdType       the judged pcd type\r
-       \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
@@ -167,37 +164,44 @@ 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
         }\r
-        \r
+\r
         return false;\r
     }\r
 \r
     /**\r
       Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database\r
-      \r
+\r
       @param   cName                     Token name.\r
       @param   tokenSpaceName            The token space guid string defined in MSA or SPD\r
-      \r
+\r
       @retval  primary key for this token in token database.\r
     **/\r
     public static String getPrimaryKeyString(String cName, String tokenSpaceName) {\r
         if (tokenSpaceName == null) {\r
             return cName + "_nullTokenSpaceGuid";\r
         } else {\r
-            return cName + "_" + tokenSpaceName.toString().replace('-', '_');\r
+            return cName + "_" + tokenSpaceName.toString().replace('-', '_').toLowerCase();\r
         }\r
     }\r
 \r
     /**\r
        If skudata list contains more than one data, then Sku mechanism is enable.\r
-       \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
@@ -207,7 +211,7 @@ public class Token {
 \r
     /**\r
        If Hii type for value of token\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isHiiEnable() {\r
@@ -219,7 +223,7 @@ public class Token {
 \r
     /**\r
        If Vpd type for value of token\r
-       \r
+\r
        @return boolean\r
     **/\r
     public boolean isVpdEnable() {\r
@@ -231,23 +235,23 @@ public class Token {
 \r
     /**\r
        Get the token primary key in token database.\r
-       \r
+\r
        @return String\r
-     */\r
+    **/\r
     public String getPrimaryKeyString () {\r
         return Token.getPrimaryKeyString(cName, tokenSpaceName);\r
     }\r
 \r
     /**\r
       Judge datumType is valid\r
-      \r
+\r
       @param type  The datumType want to be judged.\r
-      \r
+\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValiddatumType(DATUM_TYPE type) {\r
-        if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) || \r
+        if ((type.ordinal() < DATUM_TYPE.UINT8.ordinal() ) ||\r
             (type.ordinal() > DATUM_TYPE.POINTER.ordinal())) {\r
             return false;\r
         }\r
@@ -256,14 +260,14 @@ public class Token {
 \r
     /**\r
       Judge pcdType is valid\r
-      \r
+\r
       @param  type The PCdType want to be judged.\r
-      \r
+\r
       @retval TRUE  - The type is valid.\r
       @retval FALSE - The type is invalid.\r
     **/\r
     public static boolean isValidpcdType(PCD_TYPE  type) {\r
-        if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) || \r
+        if ((type.ordinal() < PCD_TYPE.FEATURE_FLAG.ordinal() ) ||\r
             (type.ordinal() > PCD_TYPE.DYNAMIC_EX.ordinal())) {\r
             return false;\r
         }\r
@@ -272,27 +276,20 @@ public class Token {
 \r
     /**\r
       Add an usage instance for token\r
-      \r
+\r
       @param usageInstance   The usage instance\r
-     \r
+\r
       @retval TRUE  - Success to add usage instance.\r
       @retval FALSE - Fail to add usage instance\r
     **/\r
-    public boolean addUsageInstance(UsageInstance usageInstance) throws EntityException {\r
-        String exceptionStr;\r
-\r
+    public boolean addUsageInstance(UsageInstance usageInstance) {\r
         if (isUsageInstanceExist(usageInstance.usageId)) {\r
-            exceptionStr = String.format("[PCD Collection Tool Exception] PCD %s for module %s has already exist in database, Please check all PCD build entries "+\r
-                                         "in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",\r
-                                         usageInstance.parentToken.cName,\r
-                                         usageInstance.usageId.moduleName,\r
-                                         usageInstance.usageId.moduleName);\r
-            throw new EntityException(exceptionStr);\r
+            return false;\r
         }\r
 \r
         //\r
         // Put usage instance into usage instance database of this PCD token.\r
-        // \r
+        //\r
         consumers.put(usageInstance.getPrimaryKey(), usageInstance);\r
 \r
         return true;\r
@@ -300,11 +297,11 @@ public class Token {
 \r
     /**\r
        Judge whether exist an usage instance for this token\r
-       \r
+\r
        @param usageId       The UsageInstance identification for usage instance\r
-       \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
@@ -313,12 +310,12 @@ public class Token {
 \r
     /**\r
       Get the PCD_TYPE according to the string of PCD_TYPE\r
-      \r
+\r
       @param pcdTypeStr    The string of 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
@@ -340,34 +337,20 @@ public class Token {
 \r
     /**\r
       Get the string of given datumType. This string will be used for generating autogen files\r
-     \r
+\r
       @param datumType   Given datumType\r
-     \r
+\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
     }\r
 \r
     /**\r
       Get the datumType according to a string.\r
-      \r
+\r
       @param datumTypeStr    The string of datumType\r
-     \r
+\r
       @return DATUM_TYPE\r
     **/\r
     public static DATUM_TYPE getdatumTypeFromString(String datumTypeStr) {\r
@@ -389,32 +372,20 @@ public class Token {
 \r
     /**\r
       Get string of given pcdType\r
-      \r
+\r
       @param pcdType  The given PcdType\r
-      \r
+\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
     }\r
 \r
     /**\r
       Get the PCD_USAGE according to a string\r
-      \r
+\r
       @param usageStr  The string of PCD_USAGE\r
-      \r
+\r
       @return The PCD_USAGE\r
     **/\r
     public static PCD_USAGE getUsageFromString(String usageStr) {\r
@@ -437,35 +408,25 @@ public class Token {
 \r
     /**\r
       Get the string of given PCD_USAGE\r
-      \r
+\r
       @param   usage   The given PCD_USAGE\r
-      \r
+\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
     }\r
 \r
     /**\r
       Get the Defined datumType string for autogen. The string is for generating some MACROs in Autogen.h\r
-      \r
+\r
       @param datumType The given datumType\r
 \r
       @return string of datum type for autogen.\r
     **/\r
     public static String GetAutogenDefinedatumTypeString(DATUM_TYPE datumType) {\r
         switch (datumType) {\r
-        \r
+\r
         case UINT8:\r
             return "8";\r
         case UINT16:\r
@@ -485,7 +446,7 @@ public class Token {
 \r
     /**\r
       Get the datumType String for Autogen. This string will be used for generating defintions of PCD token in autogen\r
-      \r
+\r
       @param datumType   The given datumType\r
 \r
       @return string of datum type.\r
@@ -511,7 +472,7 @@ public class Token {
 \r
     /**\r
       Get the datumType string for generating some MACROs in autogen file of Library\r
-      \r
+\r
       @param   datumType  The given datumType\r
 \r
       @return String of datum for genrating bit charater.\r
@@ -537,14 +498,13 @@ public class Token {
 \r
     /**\r
        Get the sku data who id is 0.\r
-       \r
+\r
        @retval DynamicTokenValue    the value of this dyanmic token.\r
     **/\r
     public DynamicTokenValue getDefaultSku() {\r
-        DynamicTokenValue dynamicData;\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
@@ -555,7 +515,7 @@ public class Token {
 \r
     /**\r
        Get the number of Sku data for this token\r
-       \r
+\r
        @retval int the number of sku data\r
     **/\r
     public int getSkuIdCount () {\r
@@ -564,9 +524,9 @@ public class Token {
 \r
     /**\r
        Get the size of PCD value, this PCD is POINTER type.\r
-       \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
@@ -590,11 +550,11 @@ public class Token {
             } else if (str.startsWith("{")) {\r
                 //\r
                 // We count the number of "," in the string.\r
-                // The number of byte is one plus the number of \r
+                // The number of byte is one plus the number of\r
                 // comma.\r
                 //\r
                 String str2 = str;\r
-                \r
+\r
                 int cnt = 0;\r
                 int pos = 0;\r
                 pos = str2.indexOf(",", 0);\r
@@ -612,17 +572,17 @@ public class Token {
     /**\r
        This method can be used to get the MAX and current size\r
        for pointer type dynamic(ex) PCD entry\r
-    **/ \r
+    **/\r
     public ArrayList<Integer> getPointerTypeSize () {\r
         ArrayList<Integer> al = new ArrayList<Integer>();\r
-        \r
+\r
         //\r
         // For VPD_enabled and HII_enabled, we can only return the MAX size.\r
         // For the default DATA type dynamic PCD entry, we will return\r
         // the MAX size and current size for each SKU_ID.\r
         //\r
         al.add(new Integer(this.datumSize));\r
-        \r
+\r
         if (!this.isVpdEnable()) {\r
             int idx;\r
             if (this.isHiiEnable()){\r
@@ -637,7 +597,7 @@ public class Token {
                 }\r
             }\r
         }\r
-        \r
+\r
         return al;\r
     }\r
 \r
@@ -645,9 +605,9 @@ public class Token {
        Get default value for a token, For HII type, HiiDefaultValue of default\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
+\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
@@ -660,19 +620,18 @@ 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
-        int               value         = 0;\r
-        boolean           isInteger     = true;\r
         DynamicTokenValue dynamicValue  = null;\r
 \r
         if (isSkuEnable()) {\r
             return true;\r
         }\r
-        \r
+\r
         if (this.isDynamicPCD) {\r
             dynamicValue = getDefaultSku();\r
             switch (dynamicValue.type) {\r
@@ -690,11 +649,11 @@ public class Token {
 \r
     /**\r
        Judge the value is NULL value. NULL value means the value is uninitialized value\r
-       \r
-       @param judgedValue\r
-       \r
-       @return boolean\r
-     */\r
+\r
+       @param judgedValue   the want want to be judged\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
@@ -704,7 +663,7 @@ public class Token {
         case UINT16:\r
         case UINT32:\r
             if (judgedValue.length() > 2) {\r
-                if ((judgedValue.charAt(0) == '0')        && \r
+                if ((judgedValue.charAt(0) == '0')        &&\r
                     ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){\r
                     subStr      = judgedValue.substring(2, judgedValue.length());\r
                     bigIntValue = new BigInteger(subStr, 16);\r
@@ -720,7 +679,7 @@ public class Token {
             break;\r
         case UINT64:\r
             if (judgedValue.length() > 2){\r
-                if ((judgedValue.charAt(0) == '0') && \r
+                if ((judgedValue.charAt(0) == '0') &&\r
                     ((judgedValue.charAt(1) == 'x') ||\r
                      (judgedValue.charAt(1) == 'X'))) {\r
                     bigIntValue = new BigInteger(judgedValue.substring(2, judgedValue.length()),  16);\r
@@ -746,12 +705,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
@@ -759,38 +727,39 @@ public class Token {
 \r
     /**\r
        Is the string value in Unicode\r
-       \r
-       @return boolean\r
+\r
+       @return boolean the string value is UNICODE type string.\r
     **/\r
     public boolean isHiiDefaultValueUnicodeStringType() {\r
         DynamicTokenValue dynamicData = getDefaultSku();\r
-        \r
+\r
         if (dynamicData == null)\r
             return false;\r
-        \r
+\r
         return dynamicData.hiiDefaultValue.startsWith("L\"")\r
                 && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
 \r
     /**\r
        Is the string value in ANSCI\r
-       \r
-       @return boolean\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
+\r
         if (dynamicData == null)\r
             return false;\r
-        \r
+\r
         return dynamicData.hiiDefaultValue.startsWith("\"")\r
         && dynamicData.hiiDefaultValue.endsWith("\"");\r
     }\r
-    \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
@@ -799,14 +768,19 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("L\"") && \r
+            str.startsWith("L\"") &&\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
 \r
         return false;\r
     }\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
@@ -815,7 +789,7 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("\"") && \r
+            str.startsWith("\"") &&\r
             str.endsWith("\"")) {\r
             return true;\r
         }\r
@@ -823,6 +797,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
@@ -831,16 +811,21 @@ public class Token {
         }\r
 \r
         if (datumType == Token.DATUM_TYPE.POINTER &&\r
-            str.startsWith("{") && \r
+            str.startsWith("{") &&\r
             str.endsWith("}")) {\r
             return true;\r
         }\r
 \r
         return false;\r
-        \r
+\r
     }\r
 \r
-    public String getStringTypeString () {                       \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
 }\r