public class NPLFunctionTable
extends java.lang.Object
Constructor and Description |
---|
NPLFunctionTable(NPLProgramIfc npl_pgm)
Construct a NPLFunctionTable instance associated with the given
NPL program.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
byte2bytes(byte b)
Returns the array of bytes representation for the specified byte value.
|
static java.lang.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 java.lang.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 java.lang.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 java.lang.String |
bytes2str(byte[] b,
java.lang.String e)
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 < right,
0 if left = right, or 1 if left > right.
|
java.lang.String |
convertDateTime(java.lang.String srcDateTime,
java.lang.String srcTimeZone,
java.lang.String srcDateTimeFormat,
java.lang.String dstTimeZone,
java.lang.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 |
currentTime()
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 java.lang.String |
double2str(double d)
Returns a string representing the specified double value.
|
static boolean |
fieldExists(DCFieldContainer record,
java.lang.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 java.lang.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 java.lang.String |
int2str(int i)
Returns a string representing the specified integer value.
|
static byte[] |
IP2bytes(IPField i)
Returns the array of bytes representation for the specified
IP address value.
|
static java.lang.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 java.lang.String |
list2str(ListField l)
Returns a string representing the specified ListField object.
|
static int |
listSize(ListField f) |
void |
logCritical(java.lang.String category,
java.lang.String specificFault,
java.lang.String errMessage)
Logs a critical message to the node's log file
|
void |
logError(java.lang.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(java.lang.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(java.lang.String category,
java.lang.String specificFault,
java.lang.String errMessage)
Logs a major message to the node's log file
|
void |
logMinor(java.lang.String category,
java.lang.String specificFault,
java.lang.String errMessage)
Logs a minor message to the node's log file
|
void |
logTrace(java.lang.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(java.lang.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(java.lang.String category,
java.lang.String specificFault,
java.lang.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 java.lang.String |
long2str(long l)
Returns a string representing the specified long value.
|
static java.lang.String |
object2str(ObjectField o)
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 java.lang.String |
short2str(short s)
Returns a string representing the specified short value.
|
static byte |
str2byte(java.lang.String s)
Returns the byte value represented by the specified string.
|
static byte[] |
str2bytes(java.lang.String s)
Returns the array of bytes representation for the specified string value,
using the platform's default character encoding.
|
static byte[] |
str2bytes(java.lang.String s,
java.lang.String e)
Returns the array of bytes representation for the specified string value,
using the specified character encoding.
|
static int |
str2decimal(java.lang.String s)
Returns the decimal value represented by the specified string.
|
static double |
str2double(java.lang.String s)
Returns the double value represented by the specified string.
|
static float |
str2float(java.lang.String s)
Returns the float value represented by the specified string.
|
static int |
str2int(java.lang.String s)
Returns the integer value represented by the specified string.
|
static byte[] |
str2IP(java.lang.String s)
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 |
str2long(java.lang.String s)
Returns the long value represented by the specified string.
|
static java.lang.String |
str2lower(java.lang.String s)
Returns the string
s converted to lower case. |
static short |
str2short(java.lang.String s)
Returns the short value represented by the specified string.
|
long |
str2TimeInMilliSecs(java.lang.String s,
java.lang.String format)
Returns a TimeInMilliSecs object converted from the given string with the
specified format.
|
int |
str2TimeInSecs(java.lang.String s,
java.lang.String format)
Returns a TimeInSecs object converted from the given string with the
specified format.
|
static java.lang.String |
str2unicode(java.lang.String str) |
static java.lang.String |
str2upper(java.lang.String s)
Returns the string
s converted to upper case. |
static int |
strlen(java.lang.String s)
Returns the length of the given string.
|
static int |
strpos(java.lang.String string,
java.lang.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 java.lang.String |
substr(java.lang.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.
|
java.lang.String |
time2str(int timeInSecs,
java.lang.String format)
Returns a string representing the given
timeInSecs value
according to the specified format . |
java.lang.String |
time2str(long timeInMilliSecs,
java.lang.String format)
Returns a string representing the given
timeInMilliSecs
value according to the specified format . |
public NPLFunctionTable(NPLProgramIfc npl_pgm)
npl_pgm
- NPL program to associate with this object instancepublic void logError(java.lang.String message)
message
- the error message to logpublic void logWarning(java.lang.String message)
message
- the warning message to logpublic void logWarning(java.lang.String category, java.lang.String specificFault, java.lang.String errMessage)
errMessage
- the warning message to logpublic void logCritical(java.lang.String category, java.lang.String specificFault, java.lang.String errMessage)
errMessage
- the warning message to logpublic void logMajor(java.lang.String category, java.lang.String specificFault, java.lang.String errMessage)
errMessage
- the warning message to logpublic void logMinor(java.lang.String category, java.lang.String specificFault, java.lang.String errMessage)
errMessage
- the warning message to logpublic void logInfo(java.lang.String message)
message
- the informational message to logpublic void logTrace(java.lang.String message)
message
- the trace message to logpublic static DCFieldContainer clone(DCFieldContainer record) throws NPLException
record
- record to cloneNPLException
- if record is not a NARpublic static boolean fieldExists(DCFieldContainer record, java.lang.String field_id)
record
- the record to testfield_id
- the id of the fieldpublic static long currentTime()
public static int strlen(java.lang.String s)
s
- the string to get the length ofpublic static int strpos(java.lang.String string, java.lang.String substring, int nth_occurrence)
string
- the string to search insubstring
- the substring to search fornth_occurrence
- the occurrence to search fornth_occurrence
of
substring
in string
, or -1 if
there is not a nth_occurrence
of
substring
in string
public static java.lang.String substr(java.lang.String s, int beginIndex, int endIndex) throws NPLException
s
that begins at the
specified beginIndex
and extends to the character at
index endIndex - 1
.s
- the stringbeginIndex
- the beginning index, inclusiveendIndex
- the ending index, exclusiveNPLException
- if runtime error while executing functionpublic static java.lang.String str2lower(java.lang.String s)
s
converted to lower case.s
- the string to convert to lower casepublic static java.lang.String str2upper(java.lang.String s)
s
converted to upper case.s
- the string to convert to upper casepublic static byte[] str2bytes(java.lang.String s)
s
- the string for which to get the array of bytes representationpublic static byte[] str2bytes(java.lang.String s, java.lang.String e) throws NPLException
s
- the string for which to get the array of bytes representatione
- the character encoding to useNPLException
public static java.lang.String bytes2str(byte[] b)
b
- the array of bytespublic static java.lang.String bytes2str(byte[] b, java.lang.String e) throws NPLException
b
- the array of bytese
- the character encoding to useNPLException
public static java.lang.String bytes2hexstr(byte[] b)
b
- the array of bytespublic static byte[] byte2bytes(byte b)
b
- the byte for which to get the array of bytes representationpublic static byte bytes2byte(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String byte2str(byte b)
b
- the byte to be converted to a stringpublic static byte str2byte(java.lang.String s) throws NPLException
s
- the string to convert to a byte valueNPLException
- if the string does not represent a valid
byte valuepublic static byte[] short2bytes(short s)
s
- the short for which to get the array of bytes representationpublic static short bytes2short(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String short2str(short s)
s
- the short to be converted to a stringpublic static short str2short(java.lang.String s) throws NPLException
s
- the string to convert to a short valueNPLException
- if the string does not represent a valid
short valuepublic static byte[] int2bytes(int i)
i
- the integer for which to get the array of bytes
representationpublic static int bytes2int(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String int2str(int i)
i
- the integer to be converted to a stringpublic static int str2decimal(java.lang.String s) throws NPLException
s
- the string to convert to a integer valueNPLException
- if the string does not represent a valid
integer valuepublic static int str2int(java.lang.String s) throws NPLException
s
- the string to convert to a integer valueNPLException
- if the string does not represent a valid
integer valuepublic static byte[] long2bytes(long l)
l
- the long for which to get the array of bytes
representationpublic static long bytes2long(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String long2str(long l)
l
- the long to be converted to a stringpublic static long str2long(java.lang.String s) throws NPLException
s
- the string to convert to a long valueNPLException
- if the string does not represent a valid
long valuepublic static byte[] float2bytes(float f)
f
- the float for which to get the array of bytes
representationpublic static float bytes2float(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String float2str(float f)
f
- the float to be converted to a stringpublic static float str2float(java.lang.String s) throws NPLException
s
- the string to convert to a float valueNPLException
- if the string does not represent a valid
float valuepublic static byte[] double2bytes(double d)
d
- the double for which to get the array of bytes
representationpublic static double bytes2double(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String double2str(double d)
d
- the double to be converted to a stringpublic static double str2double(java.lang.String s) throws NPLException
s
- the string to convert to a double valueNPLException
- if the string does not represent a valid
double valuepublic static byte[] time2bytes(int t)
t
- the TimeInSecs for which to get the array of bytes
representationpublic static int bytes2TimeInSecs(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic java.lang.String time2str(int timeInSecs, java.lang.String format) throws NPLException
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).timeInSecs
- the time in seconds value to be converted to a stringformat
- the format stringNPLException
- if runtime error while executing functionpublic int str2TimeInSecs(java.lang.String s, java.lang.String format) throws NPLException
s
- the string to convert to a TimeInSecs valueformat
- the pattern to use for the conversionNPLException
- if runtime error while executing functionpublic static byte[] time2bytes(long t)
t
- the TimeInMilliSecs for which to get the array of bytes
representationpublic static long bytes2TimeInMilliSecs(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic java.lang.String time2str(long timeInMilliSecs, java.lang.String format) throws NPLException
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).timeInMilliSecs
- the time in milliseconds value to be converted
to a stringformat
- the format stringNPLException
- if runtime error while executing functionpublic long str2TimeInMilliSecs(java.lang.String s, java.lang.String format) throws NPLException
s
- the string to convert to a TimeInMilliSecs valueformat
- the pattern to use for the conversionNPLException
- if runtime error while executing functionpublic java.lang.String convertDateTime(java.lang.String srcDateTime, java.lang.String srcTimeZone, java.lang.String srcDateTimeFormat, java.lang.String dstTimeZone, java.lang.String dstDateTimeFormat) throws NPLException
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 stringNPLException
- if an invalid time zone string or format string
was specifiedpublic static byte[] IP2bytes(IPField i) throws NPLException
i
- the IP address value for which to get the array of bytes
representationNPLException
public static byte[] bytes2IP(byte[] b) throws NPLException
b
- the array of bytesNPLException
- if runtime error while executing functionpublic static java.lang.String IP2str(IPField IPAddress) throws NPLException
IPAddress
- the IP address value to represent as a stringNPLException
public static byte[] str2IP(java.lang.String s) throws NPLException
s
- the string to convert to an IP addressNPLException
- if runtime error while executing functionpublic static java.lang.String object2str(ObjectField o)
o
- the ObjectField to be converted to a stringpublic static java.lang.String list2str(ListField l)
l
- the ListField to be converted to a stringpublic static int randomInt(int min, int max) throws NPLException
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.htmlmin
- the minimum inclusive value of the rangemax
- the maximum inclusive value of the rangeNPLException
- if runtime error while executing functionpublic static double randomDouble(double min, double max) throws NPLException
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.htmlmin
- the minimum inclusive value of the rangemax
- the maximum inclusive value of the rangeNPLException
- if runtime error while executing functionpublic static byte[] subbytes(byte[] b, int beginIndex, int endIndex) throws NPLException
beginIndex
and extends to the byte at index
endIndex
.b
- the array of bytesbeginIndex
- the beginning index, inclusiveendIndex
- the ending index, inclusiveNPLException
- if runtime error while executing functionpublic static int compareBytes(byte[] left, byte[] right)
left
- left byte array operandright
- right byte array operandpublic static byte copyBits(byte src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
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.NPLException
- if runtime error while executing functionpublic static byte copyBits(short src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
NPLException
public static byte copyBits(int src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
NPLException
public static byte copyBits(byte[] src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
NPLException
public static byte copyBits(long src, int soffset, int slength, byte dst, int doffset, int dlength) throws NPLException
NPLException
public static short copyBits(byte src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
NPLException
public static short copyBits(short src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
NPLException
public static short copyBits(int src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
NPLException
public static short copyBits(byte[] src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
NPLException
public static short copyBits(long src, int soffset, int slength, short dst, int doffset, int dlength) throws NPLException
NPLException
public static int copyBits(byte src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
NPLException
public static int copyBits(short src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
NPLException
public static int copyBits(int src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
NPLException
public static int copyBits(byte[] src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
NPLException
public static int copyBits(long src, int soffset, int slength, int dst, int doffset, int dlength) throws NPLException
NPLException
public static byte[] copyBits(byte src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
NPLException
public static byte[] copyBits(short src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
NPLException
public static byte[] copyBits(int src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
NPLException
public static byte[] copyBits(byte[] src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
NPLException
public static byte[] copyBits(long src, int soffset, int slength, byte[] dst, int doffset, int dlength) throws NPLException
NPLException
public static long copyBits(byte src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
NPLException
public static long copyBits(short src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
NPLException
public static long copyBits(int src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
NPLException
public static long copyBits(byte[] src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
NPLException
public static long copyBits(long src, int soffset, int slength, long dst, int doffset, int dlength) throws NPLException
NPLException
public static int listSize(ListField f)
public static java.lang.String str2unicode(java.lang.String str)