]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java
Add support for PCD token larger than 0x80000000 when declaring a PCD in package...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / DataValidation.java
index 2d9e75c8b56f8d93a8eddab6c86a1d875a6b49b0..82724d433886da7c39beb73eff4f56f302640452 100644 (file)
@@ -82,6 +82,40 @@ public class DataValidation {
         return true;\r
     }\r
 \r
+    /**\r
+    Check if the input data is long int and it is in the valid scope\r
+    The scope is provided by String\r
+    \r
+    @param strNumber The input string which needs validation\r
+    @param BeginNumber The left boundary of the scope\r
+    @param EndNumber The right boundary of the scope\r
+    \r
+    @retval true - The input is Int and in the scope;\r
+    @retval false - The input is not Int or not in the scope\r
+    \r
+    **/\r
+   public static boolean isLongInt(String strNumber, long BeginNumber, long EndNumber) throws Exception{\r
+       //\r
+       //Check if the input data is int first\r
+       //\r
+       if (!isInt(strNumber)) {\r
+           return false;\r
+       }\r
+       //\r
+       //And then check if the data is between the scope\r
+       //\r
+       try {\r
+          Long intTemp = new Long(strNumber);\r
+          if ((intTemp.longValue() < BeginNumber) || (intTemp.longValue() > EndNumber)) {\r
+               return false;\r
+           }\r
+       }\r
+       catch (Exception e) {\r
+          throw e;\r
+       }\r
+       \r
+       return true;\r
+   }\r
     /**\r
      Check if the input data is int and it is in the valid scope\r
      The scope is provided by String\r