Class NPLFunctionTable

java.lang.Object
com.nt.udc.npl.NPLFunctionTable

public class NPLFunctionTable extends Object
The NPLFunctionTable class provides the Java implementations of the NPL built-in functions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a NPLFunctionTable instance associated with the given NPL program.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    byte2bytes(byte b)
    Returns the array of bytes representation for the specified byte value.
    static String
    byte2str(byte b)
    Returns a string representing the specified byte value.
    static byte
    bytes2byte(byte[] b)
    Returns the value of the specified array of bytes as a byte.
    static double
    bytes2double(byte[] b)
    Returns the value of the specified array of bytes as a double.
    static float
    bytes2float(byte[] b)
    Returns the value of the specified array of bytes as a float.
    static String
    bytes2hexstr(byte[] b)
    Returns the value of the specified array of bytes as a string of space-separated hexadecimal values, where each byte corresponds to one value.
    static int
    bytes2int(byte[] b)
    Returns the value of the specified array of bytes as an integer (32 bit integer type).
    static byte[]
    bytes2IP(byte[] b)
    Returns the value of the specified array of bytes as an IP address.
    static long
    bytes2long(byte[] b)
    Returns the value of the specified array of bytes as a long (64 bit integer type).
    static short
    bytes2short(byte[] b)
    Returns the value of the specified array of bytes as a short (16 bit integer type).
    static String
    bytes2str(byte[] b)
    Returns the value of the specified array of bytes as a string, converting the bytes using the platform's default character encoding.
    static String
    bytes2str(byte[] b, String e)
    Returns the value of the specified array of bytes as a string, converting the bytes using the specified character encoding.
    static long
    Returns the value of the specified array of bytes as a 64-bit TimeInMilliSecs value.
    static int
    bytes2TimeInSecs(byte[] b)
    Returns the value of the specified array of bytes as a 32-bit TimeInSecs value.
    Returns a clone of the given record.
    static int
    compareBytes(byte[] left, byte[] right)
    Compare the two byte arrays and return -1 if left invalid input: '<' right, 0 if left = right, or 1 if left > right.
    convertDateTime(String srcDateTime, String srcTimeZone, String srcDateTimeFormat, String dstTimeZone, String dstDateTimeFormat)
    Converts the given source date-time string in the specified time zone and format to a destination date-time string in the specified time zone and format.
    static byte[]
    copyBits(byte[] src, int soffset, int slength, byte[] dst, int doffset, int dlength)
     
    static byte
    copyBits(byte[] src, int soffset, int slength, byte dst, int doffset, int dlength)
     
    static int
    copyBits(byte[] src, int soffset, int slength, int dst, int doffset, int dlength)
     
    static long
    copyBits(byte[] src, int soffset, int slength, long dst, int doffset, int dlength)
     
    static short
    copyBits(byte[] src, int soffset, int slength, short dst, int doffset, int dlength)
     
    static byte[]
    copyBits(byte src, int soffset, int slength, byte[] dst, int doffset, int dlength)
     
    static byte
    copyBits(byte src, int soffset, int slength, byte dst, int doffset, int dlength)
    Takes a source variable and a destination variable and copies source offset to length into destination offset to length.
    static int
    copyBits(byte src, int soffset, int slength, int dst, int doffset, int dlength)
     
    static long
    copyBits(byte src, int soffset, int slength, long dst, int doffset, int dlength)
     
    static short
    copyBits(byte src, int soffset, int slength, short dst, int doffset, int dlength)
     
    static byte[]
    copyBits(int src, int soffset, int slength, byte[] dst, int doffset, int dlength)
     
    static byte
    copyBits(int src, int soffset, int slength, byte dst, int doffset, int dlength)
     
    static int
    copyBits(int src, int soffset, int slength, int dst, int doffset, int dlength)
     
    static long
    copyBits(int src, int soffset, int slength, long dst, int doffset, int dlength)
     
    static short
    copyBits(int src, int soffset, int slength, short dst, int doffset, int dlength)
     
    static byte[]
    copyBits(long src, int soffset, int slength, byte[] dst, int doffset, int dlength)
     
    static byte
    copyBits(long src, int soffset, int slength, byte dst, int doffset, int dlength)
     
    static int
    copyBits(long src, int soffset, int slength, int dst, int doffset, int dlength)
     
    static long
    copyBits(long src, int soffset, int slength, long dst, int doffset, int dlength)
     
    static short
    copyBits(long src, int soffset, int slength, short dst, int doffset, int dlength)
     
    static byte[]
    copyBits(short src, int soffset, int slength, byte[] dst, int doffset, int dlength)
     
    static byte
    copyBits(short src, int soffset, int slength, byte dst, int doffset, int dlength)
     
    static int
    copyBits(short src, int soffset, int slength, int dst, int doffset, int dlength)
     
    static long
    copyBits(short src, int soffset, int slength, long dst, int doffset, int dlength)
     
    static short
    copyBits(short src, int soffset, int slength, short dst, int doffset, int dlength)
     
    static long
    Returns the current time in milliseconds since January 1, 1970 coordinated universal time (UTC).
    static byte[]
    double2bytes(double d)
    Returns the array of bytes representation for the specified double (IEEE 754 64-bit double-precision floating-point type) value.
    static String
    double2str(double d)
    Returns a string representing the specified double value.
    static boolean
    fieldExists(DCFieldContainer record, String field_id)
    Returns true if the specified field exists in the given record, false otherwise.
    static byte[]
    float2bytes(float f)
    Returns the array of bytes representation for the specified float (IEEE 754 32-bit single-precision floating-point type) value.
    static String
    float2str(float f)
    Returns a string representing the specified float value.
    static byte[]
    int2bytes(int i)
    Returns the array of bytes representation for the specified integer (32-bit integer type) value.
    static String
    int2str(int i)
    Returns a string representing the specified integer value.
    static byte[]
    Returns the array of bytes representation for the specified IP address value.
    static String
    IP2str(IPField IPAddress)
    Returns a string representing the given IP address as four unsigned decimal numbers, each representing eight bits, separated by periods.
    static String
    Returns a string representing the specified ListField object.
    static int
     
    void
    logCritical(String category, String specificFault, String errMessage)
    Logs a critical message to the node's log file
    void
    logError(String message)
    Logs an error message to the node's log file if the node's debuglevel configuration is set at the error logging level.
    void
    logInfo(String message)
    Logs an informational message to the node's log file if the node's debuglevel configuration is set for informational logging.
    void
    logMajor(String category, String specificFault, String errMessage)
    Logs a major message to the node's log file
    void
    logMinor(String category, String specificFault, String errMessage)
    Logs a minor message to the node's log file
    void
    logTrace(String message)
    Logs a trace message to the node's log file if the node's debuglevel configuration is set at the trace logging level.
    void
    logWarning(String message)
    Logs a warning message to the node's log file if the node's debuglevel configuration is set at the warning logging level.
    void
    logWarning(String category, String specificFault, String errMessage)
    Logs a warning message to the node's log file if the node's debuglevel configuration is set at the warning logging level.
    static byte[]
    long2bytes(long l)
    Returns the array of bytes representation for the specified long (64-bit integer type) value.
    static String
    long2str(long l)
    Returns a string representing the specified long value.
    static String
    Returns a string representing the specified ObjectField object.
    static double
    randomDouble(double min, double max)
    Returns a pseudorandom double value in the range from min to max inclusive, where the value of min must be less than the value of max.
    static int
    randomInt(int min, int max)
    Returns a pseudorandom integer value in the range from min to max inclusive, where the value of min must be less than the value of max.
    static byte[]
    short2bytes(short s)
    Returns the array of bytes representation for the specified short (16-bit integer type) value.
    static String
    short2str(short s)
    Returns a string representing the specified short value.
    static byte
    Returns the byte value represented by the specified string.
    static byte[]
    Returns the array of bytes representation for the specified string value, using the platform's default character encoding.
    static byte[]
    Returns the array of bytes representation for the specified string value, using the specified character encoding.
    static int
    Returns the decimal value represented by the specified string.
    static double
    Returns the double value represented by the specified string.
    static float
    Returns the float value represented by the specified string.
    static int
    Returns the integer value represented by the specified string.
    static byte[]
    Returns the IP address value represented by the given string where the expected format is four unsigned decimal numbers, each representing eight bits, separated by periods.
    static long
    Returns the long value represented by the specified string.
    static String
    Returns the string s converted to lower case.
    static short
    Returns the short value represented by the specified string.
    long
    Returns a TimeInMilliSecs object converted from the given string with the specified format.
    int
    Returns a TimeInSecs object converted from the given string with the specified format.
    static String
     
    static String
    Returns the string s converted to upper case.
    static int
    Returns the length of the given string.
    static int
    strpos(String string, String substring, int nth_occurrence)
    Returns the index of the nth occurrence of the specified substring in the given string, or -1 if there is not a nth occurrence of the specified substring in the given string.
    static byte[]
    subbytes(byte[] b, int beginIndex, int endIndex)
    Returns a copy of the array of bytes that begins at the specified beginIndex and extends to the byte at index endIndex.
    static String
    substr(String s, int beginIndex, int endIndex)
    Returns the substring of string s that begins at the specified beginIndex and extends to the character at index endIndex - 1.
    static byte[]
    time2bytes(int t)
    Returns the array of bytes representation for the specified 32-bit TimeInSecs value.
    static byte[]
    time2bytes(long t)
    Returns the array of bytes representation for the specified 64-bit TimeInMilliSecs value.
    time2str(int timeInSecs, String format)
    Returns a string representing the given timeInSecs value according to the specified format.
    time2str(long timeInMilliSecs, String format)
    Returns a string representing the given timeInMilliSecs value according to the specified format.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NPLFunctionTable

      public NPLFunctionTable(NPLProgramIfc npl_pgm)
      Construct a NPLFunctionTable instance associated with the given NPL program.
      Parameters:
      npl_pgm - NPL program to associate with this object instance
  • Method Details

    • logError

      public void logError(String message)
      Logs an error message to the node's log file if the node's debuglevel configuration is set at the error logging level. An error is indicated with a red alarm on the node GUI.
      Parameters:
      message - the error message to log
    • logWarning

      public void logWarning(String message)
      Logs a warning message to the node's log file if the node's debuglevel configuration is set at the warning logging level. An warning is indicated with a yellow alarm on the node GUI.
      Parameters:
      message - the warning message to log
    • logWarning

      public void logWarning(String category, String specificFault, String errMessage)
      Logs a warning message to the node's log file if the node's debuglevel configuration is set at the warning logging level. An warning is indicated with a yellow alarm on the node GUI.
      Parameters:
      errMessage - the warning message to log
    • logCritical

      public void logCritical(String category, String specificFault, String errMessage)
      Logs a critical message to the node's log file
      Parameters:
      errMessage - the warning message to log
    • logMajor

      public void logMajor(String category, String specificFault, String errMessage)
      Logs a major message to the node's log file
      Parameters:
      errMessage - the warning message to log
    • logMinor

      public void logMinor(String category, String specificFault, String errMessage)
      Logs a minor message to the node's log file
      Parameters:
      errMessage - the warning message to log
    • logInfo

      public void logInfo(String message)
      Logs an informational message to the node's log file if the node's debuglevel configuration is set for informational logging. No alarm is generated.
      Parameters:
      message - the informational message to log
    • logTrace

      public void logTrace(String message)
      Logs a trace message to the node's log file if the node's debuglevel configuration is set at the trace logging level. No alarm is generated.
      Parameters:
      message - the trace message to log
    • clone

      public static DCFieldContainer clone(DCFieldContainer record) throws NPLException
      Returns a clone of the given record.
      Parameters:
      record - record to clone
      Returns:
      a clone of the given record
      Throws:
      NPLException - if record is not a NAR
    • fieldExists

      public static boolean fieldExists(DCFieldContainer record, String field_id)
      Returns true if the specified field exists in the given record, false otherwise.
      Parameters:
      record - the record to test
      field_id - the id of the field
      Returns:
      true if the field exists in the record, false otherwise
    • currentTime

      public static long currentTime()
      Returns the current time in milliseconds since January 1, 1970 coordinated universal time (UTC).
      Returns:
      the current time in milliseconds since January 1, 1970 (UTC)
    • strlen

      public static int strlen(String s)
      Returns the length of the given string.
      Parameters:
      s - the string to get the length of
      Returns:
      the string's length
    • strpos

      public static int strpos(String string, String substring, int nth_occurrence)
      Returns the index of the nth occurrence of the specified substring in the given string, or -1 if there is not a nth occurrence of the specified substring in the given string.
      Parameters:
      string - the string to search in
      substring - the substring to search for
      nth_occurrence - the occurrence to search for
      Returns:
      the index of the nth_occurrence of substring in string, or -1 if there is not a nth_occurrence of substring in string
    • substr

      public static String substr(String s, int beginIndex, int endIndex) throws NPLException
      Returns the substring of string s that begins at the specified beginIndex and extends to the character at index endIndex - 1.
      Parameters:
      s - the string
      beginIndex - the beginning index, inclusive
      endIndex - the ending index, exclusive
      Returns:
      the specified substring
      Throws:
      NPLException - if runtime error while executing function
    • str2lower

      public static String str2lower(String s)
      Returns the string s converted to lower case.
      Parameters:
      s - the string to convert to lower case
      Returns:
      the string converted to lower case
    • str2upper

      public static String str2upper(String s)
      Returns the string s converted to upper case.
      Parameters:
      s - the string to convert to upper case
      Returns:
      the string converted to upper case
    • str2bytes

      public static byte[] str2bytes(String s)
      Returns the array of bytes representation for the specified string value, using the platform's default character encoding.
      Parameters:
      s - the string for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified string
    • str2bytes

      public static byte[] str2bytes(String s, String e) throws NPLException
      Returns the array of bytes representation for the specified string value, using the specified character encoding.
      Parameters:
      s - the string for which to get the array of bytes representation
      e - the character encoding to use
      Returns:
      the array of bytes representation of the specified string
      Throws:
      NPLException
    • bytes2str

      public static String bytes2str(byte[] b)
      Returns the value of the specified array of bytes as a string, converting the bytes using the platform's default character encoding. The length of the string is a function of the encoding, and thus may not be equal to the length of the array of bytes.
      Parameters:
      b - the array of bytes
      Returns:
      the string value of the array of bytes
    • bytes2str

      public static String bytes2str(byte[] b, String e) throws NPLException
      Returns the value of the specified array of bytes as a string, converting the bytes using the specified character encoding. The length of the string is a function of the encoding, and thus may not be equal to the length of the array of bytes.
      Parameters:
      b - the array of bytes
      e - the character encoding to use
      Returns:
      the string value of the array of bytes
      Throws:
      NPLException
    • bytes2hexstr

      public static String bytes2hexstr(byte[] b)
      Returns the value of the specified array of bytes as a string of space-separated hexadecimal values, where each byte corresponds to one value.
      Parameters:
      b - the array of bytes
      Returns:
      the string value of the space-separated hexadecimal values
    • byte2bytes

      public static byte[] byte2bytes(byte b)
      Returns the array of bytes representation for the specified byte value.
      Parameters:
      b - the byte for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified byte value
    • bytes2byte

      public static byte bytes2byte(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a byte.
      Parameters:
      b - the array of bytes
      Returns:
      the byte value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • byte2str

      public static String byte2str(byte b)
      Returns a string representing the specified byte value. The radix is assumed to be 10.
      Parameters:
      b - the byte to be converted to a string
      Returns:
      the string representation of the specified byte value
    • str2byte

      public static byte str2byte(String s) throws NPLException
      Returns the byte value represented by the specified string. Accepts decimal, hexadecimal, and octal numbers in the following format: Decimal: ("-")? ["1"-"9"] (["0"-"9"])* Hexadecimal: ("-")? "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ Octal: ("-")? "0" (["0"-"7"])*
      Parameters:
      s - the string to convert to a byte value
      Returns:
      the byte value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid byte value
    • short2bytes

      public static byte[] short2bytes(short s)
      Returns the array of bytes representation for the specified short (16-bit integer type) value.
      Parameters:
      s - the short for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified short value
    • bytes2short

      public static short bytes2short(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a short (16 bit integer type). The length of the array of bytes may be less than the 2 bytes to store a short, in which case the high order bytes will be padded with zeroes. An NPLException will be thrown if the length of the array of bytes is greater than 2.
      Parameters:
      b - the array of bytes
      Returns:
      the short value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • short2str

      public static String short2str(short s)
      Returns a string representing the specified short value. The radix is assumed to be 10.
      Parameters:
      s - the short to be converted to a string
      Returns:
      the string representation of the specified short value
    • str2short

      public static short str2short(String s) throws NPLException
      Returns the short value represented by the specified string. Accepts decimal, hexadecimal, and octal numbers in the following format: Decimal: ("-")? ["1"-"9"] (["0"-"9"])* Hexadecimal: ("-")? "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ Octal: ("-")? "0" (["0"-"7"])*
      Parameters:
      s - the string to convert to a short value
      Returns:
      the short value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid short value
    • int2bytes

      public static byte[] int2bytes(int i)
      Returns the array of bytes representation for the specified integer (32-bit integer type) value.
      Parameters:
      i - the integer for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified integer value
    • bytes2int

      public static int bytes2int(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as an integer (32 bit integer type). The length of the array of bytes may be less than the 4 bytes to store an integer, in which case the high order bytes will be padded with zeroes. An NPLException will be thrown if the length of the array of bytes is greater than 4.
      Parameters:
      b - the array of bytes
      Returns:
      the integer value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • int2str

      public static String int2str(int i)
      Returns a string representing the specified integer value. The radix is assumed to be 10.
      Parameters:
      i - the integer to be converted to a string
      Returns:
      the string representation of the specified integer value
    • str2decimal

      public static int str2decimal(String s) throws NPLException
      Returns the decimal value represented by the specified string. Accepts decimal Decimal: Hexadecimal: ("-")? "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ Octal: ("-")? "0" (["0"-"7"])*
      Parameters:
      s - the string to convert to a integer value
      Returns:
      the integer value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid integer value
    • str2int

      public static int str2int(String s) throws NPLException
      Returns the integer value represented by the specified string. Accepts decimal, hexadecimal, and octal numbers in the following format: Decimal: ("-")? ["1"-"9"] (["0"-"9"])* Hexadecimal: ("-")? "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ Octal: ("-")? "0" (["0"-"7"])*
      Parameters:
      s - the string to convert to a integer value
      Returns:
      the integer value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid integer value
    • long2bytes

      public static byte[] long2bytes(long l)
      Returns the array of bytes representation for the specified long (64-bit integer type) value.
      Parameters:
      l - the long for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified long value
    • bytes2long

      public static long bytes2long(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a long (64 bit integer type). The length of the array of bytes may be less than the 8 bytes to store a long, in which case the high order bytes will be padded with zeroes. An NPLException will be thrown if the length of the array of bytes is greater than 8.
      Parameters:
      b - the array of bytes
      Returns:
      the long value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • long2str

      public static String long2str(long l)
      Returns a string representing the specified long value. The radix is assumed to be 10.
      Parameters:
      l - the long to be converted to a string
      Returns:
      the string representation of the specified long value
    • str2long

      public static long str2long(String s) throws NPLException
      Returns the long value represented by the specified string. Accepts decimal, hexadecimal, and octal numbers in the following format: Decimal: ("-")? ["1"-"9"] (["0"-"9"])* Hexadecimal: ("-")? "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ Octal: ("-")? "0" (["0"-"7"])*
      Parameters:
      s - the string to convert to a long value
      Returns:
      the long value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid long value
    • float2bytes

      public static byte[] float2bytes(float f)
      Returns the array of bytes representation for the specified float (IEEE 754 32-bit single-precision floating-point type) value.
      Parameters:
      f - the float for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified float value
    • bytes2float

      public static float bytes2float(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a float. This function is expecting an array of 4 bytes in IEEE 754 32-bit single-precision floating-point type format. An NPLException will be thrown if the length of the array of bytes is not equal to 4.
      Parameters:
      b - the array of bytes
      Returns:
      the float value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • float2str

      public static String float2str(float f)
      Returns a string representing the specified float value. This string represenation format is defined according to the Java documentation for the Float.toString(float f) method (see http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Float.html#toString(float)).
      Parameters:
      f - the float to be converted to a string
      Returns:
      the string representation of the specified float value
    • str2float

      public static float str2float(String s) throws NPLException
      Returns the float value represented by the specified string. The floating-point literal format is defined in section 3.10.2 of the Java Language Specification (see http://java.sun.com/docs/books/jls/html/3.doc.html#230798).
      Parameters:
      s - the string to convert to a float value
      Returns:
      the float value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid float value
    • double2bytes

      public static byte[] double2bytes(double d)
      Returns the array of bytes representation for the specified double (IEEE 754 64-bit double-precision floating-point type) value.
      Parameters:
      d - the double for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified double value
    • bytes2double

      public static double bytes2double(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a double. This function is expecting an array of 8 bytes in IEEE 754 64-bit double-precision floating-point type format. An NPLException will be thrown if the length of the array of bytes is not equal to 8.
      Parameters:
      b - the array of bytes
      Returns:
      the double value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • double2str

      public static String double2str(double d)
      Returns a string representing the specified double value. This string represenation format is defined according to the Java documentation for the Double.toString(double d) method (see http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Double.html#toString(double)).
      Parameters:
      d - the double to be converted to a string
      Returns:
      the string representation of the specified double value
    • str2double

      public static double str2double(String s) throws NPLException
      Returns the double value represented by the specified string. The floating-point literal format is defined in section 3.10.2 of the Java Language Specification (see http://java.sun.com/docs/books/jls/html/3.doc.html#230798).
      Parameters:
      s - the string to convert to a double value
      Returns:
      the double value represented by the given string
      Throws:
      NPLException - if the string does not represent a valid double value
    • time2bytes

      public static byte[] time2bytes(int t)
      Returns the array of bytes representation for the specified 32-bit TimeInSecs value.
      Parameters:
      t - the TimeInSecs for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified TimeInSecs value
    • bytes2TimeInSecs

      public static int bytes2TimeInSecs(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a 32-bit TimeInSecs value. The length of the array of bytes may be less than the 4 bytes to store a TimeInSecs value, in which case the high order bytes will be padded with zeroes. An NPLException will be thrown if the length of the array of bytes is greater than 4.
      Parameters:
      b - the array of bytes
      Returns:
      the TimeInSecs value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • time2str

      public String time2str(int timeInSecs, String format) throws NPLException
      Returns a string representing the given timeInSecs value according to the specified format. The format string is defined according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class (see http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html).
      Parameters:
      timeInSecs - the time in seconds value to be converted to a string
      format - the format string
      Returns:
      the formatted string representation of the time value
      Throws:
      NPLException - if runtime error while executing function
    • str2TimeInSecs

      public int str2TimeInSecs(String s, String format) throws NPLException
      Returns a TimeInSecs object converted from the given string with the specified format. The format is defined according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class (see http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html).
      Parameters:
      s - the string to convert to a TimeInSecs value
      format - the pattern to use for the conversion
      Returns:
      the TimeInSecs value represented by the given string
      Throws:
      NPLException - if runtime error while executing function
    • time2bytes

      public static byte[] time2bytes(long t)
      Returns the array of bytes representation for the specified 64-bit TimeInMilliSecs value.
      Parameters:
      t - the TimeInMilliSecs for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified TimeInMilliSecs value
    • bytes2TimeInMilliSecs

      public static long bytes2TimeInMilliSecs(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as a 64-bit TimeInMilliSecs value. The length of the array of bytes may be less than the 8 bytes to store a TimeInMilliSecs value, in which case the high order bytes will be padded with zeroes. An NPLException will be thrown if the length of the array of bytes is greater than 8.
      Parameters:
      b - the array of bytes
      Returns:
      the TimeInMilliSecs value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • time2str

      public String time2str(long timeInMilliSecs, String format) throws NPLException
      Returns a string representing the given timeInMilliSecs value according to the specified format. The format string is defined according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class (see http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html).
      Parameters:
      timeInMilliSecs - the time in milliseconds value to be converted to a string
      format - the format string
      Returns:
      the formatted string representation of the time
      Throws:
      NPLException - if runtime error while executing function
    • str2TimeInMilliSecs

      public long str2TimeInMilliSecs(String s, String format) throws NPLException
      Returns a TimeInMilliSecs object converted from the given string with the specified format. The format is defined according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class (see http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html).
      Parameters:
      s - the string to convert to a TimeInMilliSecs value
      format - the pattern to use for the conversion
      Returns:
      the TimeInMilliSecs value represented by the given string
      Throws:
      NPLException - if runtime error while executing function
    • convertDateTime

      public String convertDateTime(String srcDateTime, String srcTimeZone, String srcDateTimeFormat, String dstTimeZone, String dstDateTimeFormat) throws NPLException
      Converts the given source date-time string in the specified time zone and format to a destination date-time string in the specified time zone and format. Valid time zone strings are those supported by Java which is the list returned by TimeZone.getAvailableIDs(). The format string is defined according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class (see http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html).
      Parameters:
      srcDateTime - source date-time as a string
      srcTimeZone - source time zone string
      srcDateTimeFormat - pattern string specifying the format of the source date-time string
      dstTimeZone - destination time zone string
      dstDateTimeFormat - pattern string specifying the format of the destination date-time string
      Returns:
      the string representing the conversion of the source date-time string in the source time zone and in the specified pattern to the destination date-time string in the destination time zone using the specified format
      Throws:
      NPLException - if an invalid time zone string or format string was specified
    • IP2bytes

      public static byte[] IP2bytes(IPField i) throws NPLException
      Returns the array of bytes representation for the specified IP address value.
      Parameters:
      i - the IP address value for which to get the array of bytes representation
      Returns:
      the array of bytes representation of the specified IP address value
      Throws:
      NPLException
    • bytes2IP

      public static byte[] bytes2IP(byte[] b) throws NPLException
      Returns the value of the specified array of bytes as an IP address. This function is expecting an array of 4 bytes where each byte is interpreted as an unsigned decimal number in the IP address. An NPLException will be thrown if the length of the array of bytes is not equal to 4.
      Parameters:
      b - the array of bytes
      Returns:
      the IP address value of the array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • IP2str

      public static String IP2str(IPField IPAddress) throws NPLException
      Returns a string representing the given IP address as four unsigned decimal numbers, each representing eight bits, separated by periods.
      Parameters:
      IPAddress - the IP address value to represent as a string
      Returns:
      the IP address as a string
      Throws:
      NPLException
    • str2IP

      public static byte[] str2IP(String s) throws NPLException
      Returns the IP address value represented by the given string where the expected format is four unsigned decimal numbers, each representing eight bits, separated by periods.
      Parameters:
      s - the string to convert to an IP address
      Returns:
      the given string converted to an IP address
      Throws:
      NPLException - if runtime error while executing function
    • object2str

      public static String object2str(ObjectField o)
      Returns a string representing the specified ObjectField object.
      Parameters:
      o - the ObjectField to be converted to a string
      Returns:
      the string representation of the specified ObjectField
    • list2str

      public static String list2str(ListField l)
      Returns a string representing the specified ListField object.
      Parameters:
      l - the ListField to be converted to a string
      Returns:
      the string representation of the specified ListField
    • randomInt

      public static int randomInt(int min, int max) throws NPLException
      Returns a pseudorandom integer value in the range from min to max inclusive, where the value of min must be less than the value of max. Refer to Java's Random class for a description of the random number generator algorithm. See http://java.sun.com/products/jdk/1.2/docs/api/java/util/Random.html
      Parameters:
      min - the minimum inclusive value of the range
      max - the maximum inclusive value of the range
      Returns:
      the pseudorandom integer value in the specified range
      Throws:
      NPLException - if runtime error while executing function
    • randomDouble

      public static double randomDouble(double min, double max) throws NPLException
      Returns a pseudorandom double value in the range from min to max inclusive, where the value of min must be less than the value of max. Refer to Java's Random class for a description of the random number generator algorithm. See http://java.sun.com/products/jdk/1.2/docs/api/java/util/Random.html
      Parameters:
      min - the minimum inclusive value of the range
      max - the maximum inclusive value of the range
      Returns:
      the pseudorandom double value in the specified range
      Throws:
      NPLException - if runtime error while executing function
    • subbytes

      public static byte[] subbytes(byte[] b, int beginIndex, int endIndex) throws NPLException
      Returns a copy of the array of bytes that begins at the specified beginIndex and extends to the byte at index endIndex.
      Parameters:
      b - the array of bytes
      beginIndex - the beginning index, inclusive
      endIndex - the ending index, inclusive
      Returns:
      the specified array of bytes
      Throws:
      NPLException - if runtime error while executing function
    • compareBytes

      public static int compareBytes(byte[] left, byte[] right)
      Compare the two byte arrays and return -1 if left invalid input: '<' right, 0 if left = right, or 1 if left > right. This method assumes the byte arrays are not null, are equal in length and in big-endian order.
      Parameters:
      left - left byte array operand
      right - right byte array operand
      Returns:
      -1 if left invalid input: '<' right; 0 if left = right; 1 if left > right
    • copyBits

      public static byte copyBits(byte src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
      Takes a source variable and a destination variable and copies source offset to length into destination offset to length. Returns the new variable that represents Destination with the source bits copied into the appropriate location.
      Parameters:
      src - The source attribute which is being copied. Must be a byte, short, int, bytes, or long
      soffset - The offset in src where the copying will begin.
      slength - how much of src to copy.
      dst - The destination attribute which is having the src copied into it. Must be a byte, short, int, bytes or long, and the range alotted for the copy must be large enough to contain the range from the src.
      doffset - The offset in the dst where the src will be copied.
      dlength - The length of the range into which the src will be copied.
      Returns:
      A value of the same type as the dst parameter. Contains the destination value with the source copied into the appropriate bit range.
      Throws:
      NPLException - if runtime error while executing function
    • copyBits

      public static byte copyBits(short src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte copyBits(int src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte copyBits(byte[] src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte copyBits(long src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static short copyBits(byte src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static short copyBits(short src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static short copyBits(int src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static short copyBits(byte[] src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static short copyBits(long src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static int copyBits(byte src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static int copyBits(short src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static int copyBits(int src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static int copyBits(byte[] src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static int copyBits(long src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte[] copyBits(byte src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte[] copyBits(short src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte[] copyBits(int src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte[] copyBits(byte[] src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static byte[] copyBits(long src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static long copyBits(byte src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static long copyBits(short src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static long copyBits(int src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static long copyBits(byte[] src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • copyBits

      public static long copyBits(long src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
      Throws:
      NPLException
    • listSize

      public static int listSize(ListField f)
    • str2unicode

      public static String str2unicode(String str)