Package com.nt.udc.npl
Class NPLFunctionTable
java.lang.Object
com.nt.udc.npl.NPLFunctionTable
The NPLFunctionTable class provides the Java implementations of the
NPL built-in functions.
-
Constructor Summary
ConstructorsConstructorDescriptionNPLFunctionTable
(NPLProgramIfc npl_pgm) Construct a NPLFunctionTable instance associated with the given NPL program. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
Returns the value of the specified array of bytes as a string, converting the bytes using the specified character encoding.static long
bytes2TimeInMilliSecs
(byte[] b) 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.static DCFieldContainer
clone
(DCFieldContainer record) 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
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 filevoid
Logs an error message to the node's log file if the node's debuglevel configuration is set at the error logging level.void
Logs an informational message to the node's log file if the node's debuglevel configuration is set for informational logging.void
Logs a major message to the node's log filevoid
Logs a minor message to the node's log filevoid
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 frommin
tomax
inclusive, where the value ofmin
must be less than the value ofmax
.static int
randomInt
(int min, int max) Returns a pseudorandom integer value in the range frommin
tomax
inclusive, where the value ofmin
must be less than the value ofmax
.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
str2double
(String s) 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 strings
converted to lower case.static short
Returns the short value represented by the specified string.long
str2TimeInMilliSecs
(String s, String format) Returns a TimeInMilliSecs object converted from the given string with the specified format.int
str2TimeInSecs
(String s, String format) Returns a TimeInSecs object converted from the given string with the specified format.static String
str2unicode
(String str) static String
Returns the strings
converted to upper case.static int
Returns the length of the given string.static int
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 specifiedbeginIndex
and extends to the byte at indexendIndex
.static String
Returns the substring of strings
that begins at the specifiedbeginIndex
and extends to the character at indexendIndex - 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.Returns a string representing the giventimeInSecs
value according to the specifiedformat
.Returns a string representing the giventimeInMilliSecs
value according to the specifiedformat
.
-
Constructor Details
-
NPLFunctionTable
Construct a NPLFunctionTable instance associated with the given NPL program.- Parameters:
npl_pgm
- NPL program to associate with this object instance
-
-
Method Details
-
logError
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
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
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
Logs a critical message to the node's log file- Parameters:
errMessage
- the warning message to log
-
logMajor
Logs a major message to the node's log file- Parameters:
errMessage
- the warning message to log
-
logMinor
Logs a minor message to the node's log file- Parameters:
errMessage
- the warning message to log
-
logInfo
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
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
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
Returns true if the specified field exists in the given record, false otherwise.- Parameters:
record
- the record to testfield_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
Returns the length of the given string.- Parameters:
s
- the string to get the length of- Returns:
- the string's length
-
strpos
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 insubstring
- the substring to search fornth_occurrence
- the occurrence to search for- Returns:
- the index of the
nth_occurrence
ofsubstring
instring
, or -1 if there is not anth_occurrence
ofsubstring
instring
-
substr
Returns the substring of strings
that begins at the specifiedbeginIndex
and extends to the character at indexendIndex - 1
.- Parameters:
s
- the stringbeginIndex
- the beginning index, inclusiveendIndex
- the ending index, exclusive- Returns:
- the specified substring
- Throws:
NPLException
- if runtime error while executing function
-
str2lower
Returns the strings
converted to lower case.- Parameters:
s
- the string to convert to lower case- Returns:
- the string converted to lower case
-
str2upper
Returns the strings
converted to upper case.- Parameters:
s
- the string to convert to upper case- Returns:
- the string converted to upper case
-
str2bytes
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
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 representatione
- the character encoding to use- Returns:
- the array of bytes representation of the specified string
- Throws:
NPLException
-
bytes2str
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
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 bytese
- the character encoding to use- Returns:
- the string value of the array of bytes
- Throws:
NPLException
-
bytes2hexstr
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Returns a string representing the giventimeInSecs
value according to the specifiedformat
. 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 stringformat
- the format string- Returns:
- the formatted string representation of the time value
- Throws:
NPLException
- if runtime error while executing function
-
str2TimeInSecs
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 valueformat
- 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
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
Returns a string representing the giventimeInMilliSecs
value according to the specifiedformat
. 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 stringformat
- the format string- Returns:
- the formatted string representation of the time
- Throws:
NPLException
- if runtime error while executing function
-
str2TimeInMilliSecs
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 valueformat
- 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 stringsrcTimeZone
- source time zone stringsrcDateTimeFormat
- pattern string specifying the format of the source date-time stringdstTimeZone
- destination time zone stringdstDateTimeFormat
- 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
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
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
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
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
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
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
Returns a pseudorandom integer value in the range frommin
tomax
inclusive, where the value ofmin
must be less than the value ofmax
. 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 rangemax
- 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
Returns a pseudorandom double value in the range frommin
tomax
inclusive, where the value ofmin
must be less than the value ofmax
. 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 rangemax
- 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
Returns a copy of the array of bytes that begins at the specifiedbeginIndex
and extends to the byte at indexendIndex
.- Parameters:
b
- the array of bytesbeginIndex
- the beginning index, inclusiveendIndex
- 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 operandright
- 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 longsoffset
- 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
-
str2unicode
-