JAVA Tool SetJAVA Programmed Components and Functions |
Component Historical Record of Change page.
Trial and Pricing page.
Trial the programming for the below described functions.
Component Description
cpcConsole Performs console I/O .
Methods:
read -- Reads a line of alphanumeric data from the console.
Returns String.
readInt -- Reads an integer from the console.
Returns Integer.
readLong -- Reads a long precision integer from the console.
Returns Long.
readFloat -- Reads an floating point number from the console.
Returns Float.
readDouble -- Reads a double precision floating point number
from the console.
Returns Double.
write -- Writes either a single string, or
a string, then integer to the console.
Up to 3 pairs of string,integer.
No Return.
cpcDate Fetches and formats the date in various forms.
Formatted date is returned as a String.
Type Formatted Return String
B : nnnnnn days since 0001/01/01
C : nnnnnn days since 1900/01/01
DAY : Day Alph day of the week
E : DD/MM/YY European format
G : CCYY/MM/DD Century format
J : YYDDD Julian format
M : Month Numeric month
MON : Month Alpha month
N : MM/DD/YYYY Normal format
O : YY/MM/DD Ordered format
Q : DDDDDD days since
R : SSSSSSS seconds since
S : CCYYMMDD Standard format
U : MM/DD/YY Universal format
Methods:
date(String) ,request return of a date in some given format.
cpcEcb Wait and Post over an Event Control Block.
Creates and cpcEcb object that acts as the Event Control Block.
One or more threads can wait on the ECB to be posted. Some other
thread should post the ECB and thus causing all waiters to resume
execution.
Methods:
waitecb() -- Waits for the posting of an event control block.
waitecb(long timeout) -- Waits for the posting of an event control block
or the expiration of the timeout (in milliseconds).
Return Type int
0 -- Successful Posting occurred
1 -- Timeout occurred
postecb() -- Marks an event control block as posted, and frees
all threads waiting on the ecb resource.
resetecb() -- Marks an event control block as unposted.
cpcEnq Resource Lock Manager.
Allows task(s) to enqueue (block) on a object for the process of
resource access serialization.
Reserve, attempReserve, Release, Test and Test_and_Set a resource.
Methods:
reserve() -- Attempts to gain access to the monitor lock. Will wait
if the lock is currently held by another task (Thread).
Return Type int
0 -- Successful
-1 -- Interruption
attemptReserve(long timeout) -- Attempts to gain access to the monitor
lock. Will wait up through TIMEOUT specified for the lock to be
released by the task that currently holds it.
Return Type int
0 -- Successful
1 -- Failed (TIMEOUT occurred)
-1 -- Interruption
release() -- Releases the monitor lock and causes a notifyAll to all
requestors of the lock.
Return Type int
0 -- Successful
-1 -- Interruption
testlock() -- Tests to see if the lock is held.
Return Type int
0 -- Resource is currently Free
1 -- Currently lock is being held by some other task.
testset() -- Tests the lock and if free then reserves the lock.
Return Type int
0 -- Successful lock
1 -- Currently lock is being held by some other task.
cpcFileIO File I/O Management.
Performs read/write file I/O against legacy record delimited
files.
actualName --
read -- Reads a file 1 record at a time.
write -- Writes a file 1 record at a time.
readStem -- Reads the entire file into STEM array in virtual storage.
readbuf -- Reads the entire file into a buffer.
writeStem -- Writes the entire file from STEM array in virtual storage.
writebuf -- Writes the entire file from a buffer.
filexist -- Checks for existence of a file.
open -- Opens a file for input or output.
close -- Closes a file.
lineappend -- Appends a line to the end of a file
pathing -- Returns full pathname to file.
state -- Returns the state of a file.
cpcString Performs various function manipulations on strings.
and (implements Rexx_type manipulations to JAVA Strings)
ctsString
cpcString is Static Methods
ctsString is Instantiateable
Methods:
b2x -- Convert binary to hex.
Returns a hexadecimal string upon input of a binary string.ng
Each 4 characters of input will return 1 character of translated output.
ie. s1 = "00101110111111101"
s2 = cpcString.b2x(s1)
s2 contains "2FED"
changestr -- Returns a string where each occurence of the original string
is replaced by a new string.
copies -- Returns "n" concatenated copies of a string.
ie. s1 = "Pp"
s2 = cpcString.copies(s1,10)
s2 contains "PpPpPpPpPpPpPpPpPpPp"
countstr -- Returns the count of all non-overlapping occurrences of a
"needle_argument" in a string.
ie. s1 = "AAbbCCDDee123457CC8234"
s2 = cpcString.countstr(s1,"CC")
s2 contains 2
c2d -- Convert character to decimal.
Returns a decimal string upon input of a character string.
Each character of input will return 3 characters of translated output.
ie. s1 = "ABCDxyz
s2 = cpcString.c2d(s1)
s2 contains "65666768120121122"
c2x -- Convert character to hex.
Returns a hexadecimal string upon input of a character string.
Each character of input will return 2 characters of translated output.
ie. s1 = "ABCDxyz
s2 = cpcString.c2x(s1)
s2 contains "4142434478797A"
datatype -- Returns "true" if a string matches the description requested
by the "option", otherwise returns "false"
Options:
A (alphanumeric)
B (binary)
D (digits)
L (lower case)
M (mixed case)
N (number)
S (symbol)
U (upper)
W (whole number)
X (hexadecimal)
delstr(string,n[,k]) -- Returns a string with "length" characters
of the string deleted starting at position "n".
"k" denotes the length of characters to delete from position "n".
"k" defaults to the remaining length of the string.
ie. s1 = "Now is the time for all Good men to help."
s2 = cpcString.delstr(s1,20,4)
s2 contains "Now is the time for Good men to help".
delword(string,n[,k]) -- Returns a string of "length" words of
string deleted, starting at word "n" of the original string.
"k" denotes the number of words to delete from word "n".
"k" defaults to the remaining words of the string.
ie. s1 = "Now is the time for all Good men to help."
s2 = cpcString.delword(s1,6,1)
s2 contains "Now is the time for all men to help".
d2c -- Convert decimal to character.
Returns the corresponding character string upon input of its decimal
represented string. Every 3 input characters will return 1 translated
output character.
ie. s1 = "101102103104"
s2 = cpcString.d2c(s1)
s2 contains "efgh"
d2x -- Convert decimal to hex.
Returns a hexadecimal string upon input of a decimal string.
Every 3 input characters will return 2 translated output characters.
ie. s1 = "101102103"
s2 = cpcString.d2x(s1)
s2 contains "656667"
insert(string,new_string,n,length[,pad]) -- Returns a string where a "newstring" is
inserted, padded or truncated to length "l", at position "n" into the original string.
lower(string,n,l) -- Returns a string where all the characters of the original string, starting
from position "n" for length "l" characters are changed to lowercase.
overlay(string,new_string,n,length[,pad]) -- Returns a string, where the "newstring"
is padded or truncated to length "l", overlays any character of teh original string
starting from position "n".
parseliteral(string,template) -- Returns a String array where each element is a string
parsed by the LITERAL characters appearing in the "template" argument.
Each LITERAL character in the template string causes left-to-right scanning of the original
data string to find a match to the value of the LITERAL character. A null template
string matches the end of the data.
The "period" if used in the template acts as a placeholder in the template. It has the
effect of skipping scanning of any data that appears in the original string at that
placement relative to the prior and remaining template patterns.
The "template" consists of 1 or more characters.
Returns null if no match for "template".
Spaces are trimmed from all returns.
As each template character is found in the string, the substring up to that point is cut
away and placed in the return array element[i]. Subsequent parsing of the original string
continues with the next string character being parsed with the next template character.
Example: String time = "12:30:59"
tword[] = cpcString.parse(time,"::")
tword[0] contains string "12"
tword[1] contains string "30"
tword[2] contains string "59"
Example: String time = "12:30:59"
tword[] = cpcString.parse(time,".::.")
tword[0] contains string "30"
Example: String time = "12:30:59"
tword[] = cpcString.parse(time,":.:")
tword[0] contains string "12"
tword[1] contains string "59"
parse2char(string,template) -- Returns a String that is a subset of the original, parsed to
the point of where single character_string "template" occurs.
Returns null if no match for "template".
Spaces are trimmed from all returns.
Example: String time = "Now is the time for all Good Men to come to the aid of their country."
hstring = cpcString.parse2char(sentence,"G")
hstring contains the string "Now is the time for all"
pos(string,needle,n) -- Returns the position of the "needle_argument" in the
original string, starting at position "n".
removestr(string,target_string,n) -- Returns a string after remove each occurrence of
the target string "target_string") from the original string.
removeword(string,target_word,n) -- Returns a string after remove each occurrence of
the target word "target_word") from the original string.
reverse(string) -- Returns a string where the original string's character order has
been reversed.
strip(string,option[,char]) -- Returns a string where all of the leading, trailing
or both characters of the original string are removed. The "option" specifies
"L" for leading, "T" for trailing, or "B" for both, and "char" defaults to blank.
substr(string,n[,l[,pad]]) -- Returns a substring of the original string, starting
at position "n" for length "l", padded with pad if necessary.
The length "l" defaults to the remaining length of the string.
substring(string,n[,l]])
Synonym for substr function.
subword(string,n[,l]) -- Returns a substring of the original string starting
with the nth word and up to length "l" blank delimited words long.
The length "l" defaults to the remaining words of the string.
translate(string,otable,itable[,pad]) -- Returns a string where every character in
the original string that is found in the input table "itable" is replaced by the
matching displacement character (at an equal position) of output table "otable".
The output string is truncated or padded with pad to the length of the original string.
upper(string[,n[,l]]) -- Returns a string where all the characters of the original string, starting
from position "n" for length "l" characters are changed to uppercase.
word(string,n) -- Returns the nth word of the specified string.
wordindex(string,n) -- Returns the character position of the nth word of the specified string.
wordinsert(string,new_string,n) -- Returns a string after inserting "new_string" into the
original string at word position "n".
wordlength(string,n) -- Returns the length of the nth word of the specified string.
wordpos(string,phrase,start) -- Returns the word number of the first word of "phrase" in the
original string starting at word number "start".
x2b -- Convert hex to binary.
Returns a binary string upon input of a hexadecimal string.
Every 2 input characters will return 4 translated output characters.
ie s1 = "DDFFEE""
s2 = cpcString.x2b(s1)
s2 = "110111011111111111101110"
x2b -- Convert hex to character.
Returns a character string upon input of a hexadecimal string.
Every 2 input characters will return 1 translated output characters.
ie s1 = "65666768"
s2 = cpcString.x2c(s1)
s2 = "efgh"
x2d -- Convert hex to decimal.
Returns a decimal string upon input of a hexadecimal string.
Every 2 input characters will return 3 translated output characters.
ie s1 = "65666768"
s2 = cpcString.x2d(s1)
s2 = "101102103104"
cpcTime Fetches and formats the time of day in various forms.
Arguments
N : normal hh:mm:ss
C : civil hh:mmXX XX = am or pm
H : hours since midnight
M : minutes since midnight
S : seconds since midnight
Z : zone: time zone (eg. GMT, CET, etc.)
Methods:
time(String) -- Returns formatted time
FlagException Processes and displays information regarding a captured
exception upon the console.
Methods:
error(exception) -- displays data about the exception.
error(exception,Object) -- displays data about the exception
along with the caller Object program that caught it.
TimerComponent Allows setting of single or repetitive times in which
(Bean) you can program an object to sleep for a given interval
or until a given time. After the expiration of the sleep
interval a "Timer Pop" interrupt will be presented to all the
objects that appear as interested parties via the "listener list".
A property change of "running,on|off,on|off" is available to all interested
parties appearing on the PropertyChangeListener list.
A single "Sleep Time" can be specified as a discrete
time of day (ie 12:30:26),
Or a time of day displacement (ie. +01:20:00),
Or as a number of milliseconds (ie. 2000 (2sec))
Repetitive "Sleep Time" can be specified that same as the
single above. You would just use a different contructor.
Methods:
setInterval(int n) ,where n is the number of milliseconds to sleep
setBeaconInterval(int n) ,where n is the number of millisecs to
sleep between beacons to the TimerListener(s).
setWakeupTime(String s) ,where s is the time of wakeup if it is in
the form of HH:MM:SS and the displacement to the current time if in
the form of +HH:MM:SS.
setRepetitiveWakeup(String s) ,where s is the form of the above. The
TimerListeners will be beaconed at each expiration.
TimeCalc Calculates and resolves the difference or the sum of two timestamps
that are supplied as String arguments.
Such as CC:YY:DDD:HH:MM:SS:CC
where CCYY is the 4-digit year
DDD is the Julian day of the year
HH is the hour of the day
MM is the minute
SS is the second
CC is the hundredths of a second
Methods:
timeDiff(String,String) -- Accepts timestamps in the form of CCYYDDDHHMMSSCC
and returns the difference in the same format.
timeDiff1(String,String) -- Accepts timestamps in the form of CCYY:DDD:HH:MM:SS:CC
and returns the difference in the same format.
timeDiff2(String,String) -- Accepts timestamps in the form of CCYY/DDD/HH/MM/SS/CC
and returns the difference in the same format.
timeDiff3(String,String) -- Accepts timestamps in the form of CCYY\DDD\HH\MM\SS\CC
and returns the difference in the same format.
timeSum(String,String) -- Accepts timestamps in the form of CCYYDDDHHMMSSCC
and returns the sum in the same format.
timeSum1(String,String) -- Accepts timestamps in the form of CCYY:DDD:HH:MM:SS:CC
and returns the sum in the same format.
timeSum2(String,String) -- Accepts timestamps in the form of CCYY/DDD/HH/MM/SS/CC
and returns the sum in the same format.
timeSum3(String,String) -- Accepts timestamps in the form of CCYY\DDD\HH\MM\SS\CC
and returns the sum in the same format.
*Due to US Government restrictions, CPC software products are not
exportable to Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria; list is
subject to change.