 |  The Rexx class The class netrexx.lang.Rexx implements the NetRexx string class, and includes the ?built-in’ methods (described in [NRL 148]). Described here are the platform-dependent methods as provided in the reference implementation: constructors for the class, the methods for arithmetic operations, and miscellaneous methods intended for general use. The class netrexx.lang.Rexx is serializable. Rexx constructors These constructors all create a string of type netrexx.lang.Rexx. - Rexx(arg=boolean)
Constructs a string which will have the value '1' if arg is 1 (true) or the value '0' if arg is 0 (false). - Rexx(arg=byte)
Constructs a string which is the decimal representation of the 8-bit signed binary integer arg. The string will contain only decimal digits, prefixed with a leading minus sign (hyphen) if arg is negative. A leading zero will be present only if arg is zero. - Rexx(arg=char)
Constructs a string of length 1 whose first and only character is a copy of arg. - Rexx(arg=char[])
Constructs a string by copying the characters of the character array arg in sequence. The length of the string is the number of elements in the character array (that is, arg.length). - Rexx(arg=int)
Constructs a string which is the decimal representation of the 32-bit signed binary integer arg. The string will contain only decimal digits, prefixed with a leading minus sign (hyphen) if arg is negative. A leading zero will be present only if arg is zero. - Rexx(arg=double)
Constructs a string which is the decimal representation of the 64-bit signed binary floating point number arg. (The precise format of the result may change and will be defined later.) - Rexx(arg=float)
Constructs a string which is the decimal representation of the 32-bit signed binary floating point number arg. (The precise format of the result may change and will be defined later.) - Rexx(arg=long)
Constructs a string which is the decimal representation of the 64-bit signed binary integer arg. The string will contain only decimal digits, prefixed with a leading minus sign (hyphen) if arg is negative. A leading zero will be present only if arg is zero. - Rexx(arg=Rexx)
Constructs a string which is copy of arg, which is of type netrexx.lang.Rexx. arg must not be null. Any sub-values [NRL 70] are ignored (that is, they are not present in the object returned by the constructor). - Rexx(arg=short)
Constructs a string which is the decimal representation of the 16-bit signed binary integer arg. The string will contain only decimal digits, prefixed with a leading minus sign (hyphen) if arg is negative. A leading zero will be present only if arg is zero. - Rexx(arg=String)
Constructs a NetRexx string by copying the characters of arg, which is of type java.lang.String, in sequence. The length of the string is same as the length of arg (that is, arg.length()). arg must not be null. - Rexx(arg=String[])
Constructs a NetRexx string by concatenating the elements of the java.lang.String array arg together in sequence with a blank between each pair of elements. This may be used for converting the argument word array passed to the main method of a Java application into a single string. If the number of elements of arg is zero then an empty string (of length 0) is returned. Otherwise, the length of the string is the sum of the lengths of the elements of arg, plus the number of elements of arg, less one. arg must not be null.
Rexx arithmetic methods These methods implement the NetRexx arithmetic operators, as described in [NRL 130]. Each corresponds to and implements a method in the RexxOperators interface class. Each of the methods here takes a RexxSet object as an argument. This argument provides the numeric settings for the operation; if null is provided for the argument then the default settings are used (digits=9, form=scientific). For monadic operators, only the RexxSet argument is present; the operation acts upon the current object. For dyadic operators, the RexxSet argument and a Rexx argument are present; the operation acts with the current object being the left-hand operand and the second argument being the right-hand operand. For example, under default numeric settings, the expression: award+extra (where award and extra are references to objects of type Rexx) could be written as: award.OpAdd(null, extra) which would return the result of adding award and extra under the default numeric settings. - OpAdd(set=RexxSet, rhs=Rexx)
Implements the NetRexx + (Add) operator [NRL 57], and returns the result as a string of type Rexx. - OpAnd(set=RexxSet, rhs=Rexx)
Implements the NetRexx & (And) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpCc(set=RexxSet, rhs=Rexx)
Implements the NetRexx || or abuttal (Concatenate without blank) operator [NRL 57], and returns the result as a string of type Rexx. - OpCcblank(set=RexxSet, rhs=Rexx)
Implements the NetRexx blank (Concatenate with blank) operator [NRL 57], and returns the result as a string of type Rexx. - OpDiv(set=RexxSet, rhs=Rexx)
Implements the NetRexx / (Divide) operator [NRL 57], and returns the result as a string of type Rexx. - OpDivI(set=RexxSet, rhs=Rexx)
Implements the NetRexx % (Integer divide) operator [NRL 57], and returns the result as a string of type Rexx. - OpEq(set=RexxSet, rhs=Rexx)
Implements the NetRexx = (Equal) operator [NRL 58], and returns a result (0 or 1) of type boolean. - OpEqS(set=RexxSet, rhs=Rexx)
Implements the NetRexx == (Strictly equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpGt(set=RexxSet, rhs=Rexx)
Implements the NetRexx > (Greater than) operator [NRL 58], and returns a result (0 or 1) of type boolean. - OpGtEq(set=RexxSet, rhs=Rexx)
Implements the NetRexx >= (Greater than or equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpGtEqS(set=RexxSet, rhs=Rexx)
Implements the NetRexx >>= (Strictly greater than or equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpGtS(set=RexxSet, rhs=Rexx)
Implements the NetRexx >> (Strictly greater than) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpLt(set=RexxSet, rhs=Rexx)
Implements the NetRexx < (Less than) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpLtEq(set=RexxSet, rhs=Rexx)
Implements the NetRexx <= (Less than or equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpLtEqS(set=RexxSet, rhs=Rexx)
Implements the NetRexx <<= (Strictly less than or equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpLtS(set=RexxSet, rhs=Rexx)
Implements the NetRexx << (Strictly less than) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpMinus(set=RexxSet)
Implements the NetRexx Prefix - (Minus) operator [NRL 57], and returns the result as a string of type Rexx. - OpMult(set=RexxSet, rhs=Rexx)
Implements the NetRexx * (Multiply) operator [NRL 57], and returns the result as a string of type Rexx. - OpNot(set=RexxSet)
Implements the NetRexx Prefix \ (Not) operator [NRL 60], and returns a result (0 or 1) of type boolean. - OpNotEq(set=RexxSet, rhs=Rexx)
Implements the NetRexx \= (Not equal) operator [NRL 58], and returns a result (0 or 1) of type boolean. - OpNotEqS(set=RexxSet, rhs=Rexx)
Implements the NetRexx \== (Strictly not equal) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpOr(set=RexxSet, rhs=Rexx)
Implements the NetRexx | (Inclusive or) operator [NRL 59], and returns a result (0 or 1) of type boolean. - OpPlus(set=RexxSet)
Implements the NetRexx Prefix + (Plus) operator [NRL 57], and returns the result as a string of type Rexx. - OpPow(set=RexxSet, rhs=Rexx)
Implements the NetRexx ** (Power) operator [NRL 57], and returns the result as a string of type Rexx. - OpRem(set=RexxSet, rhs=Rexx)
Implements the NetRexx // (Remainder) operator [NRL 57], and returns the result as a string of type Rexx. - OpSub(set=RexxSet, rhs=Rexx)
Implements the NetRexx - (Subtract) operator [NRL 57], and returns the result as a string of type Rexx. - OpXor(set=RexxSet, rhs=Rexx)
Implements the NetRexx && (Exclusive or) operator [NRL 60], and returns a result (0 or 1) of type boolean.
Rexx miscellaneous methods These methods provide standard Java methods for the class, together with various conversions. - charAt(offset=int)
Returns the character from the string at offset (that is, if offset is 0 then the first character is returned, etc.). The character is returned as type char. If offset is negative, or is greater than or equal to the length of the string, an exception is signalled. - equals(item=Object)
Compares the string with the value of item, using a strict character-by-character comparison, and returns a result of type boolean. If item is null or is not an instance of one of the types Rexx, java.lang.String, or char[], then 0 is returned. Otherwise, item is converted to type Rexx and the OpEqS method (or equivalent) is used to compare the current string with the converted string, and its result is returned. - hashCode()
Returns a hashcode of type int for the string. This hashcode is suitable for use by the java.util.Hashtable class. - toboolean()
Converts the string to type boolean. If the string is neither ?0’ nor ?1’ then a NotLogicException is signalled. - tobyte()
Converts the string to type byte. If the string is not a number, has a non-zero decimal part, or is out of the possible range for a byte (8-bit signed integer) result then a NumberFormatException is signalled. - tochar()
Converts the string to type char. If the string is not exactly one character in length then a NotCharacterException is signalled. - toCharArray()
Converts the string to type char[]. A character array object of the same length as the string is created, and the characters of the string are copied to the array in sequence. The character array is then returned. - todouble()
Converts the string to type double. If the string is not a number, or is out of the possible range for a double (64-bit signed floating point) result then a NumberFormatException is signalled. - tofloat()
Converts the string to type float. If the string is not a number, or is out of the possible range for a float (32-bit signed floating point) result then a NumberFormatException is signalled. - toint()
Converts the string to type int. If the string is not a number, has a non-zero decimal part, or is out of the possible range for an int (32-bit signed integer) result then a NumberFormatException is signalled. - tolong()
Converts the string to type long. If the string is not a number, has a non-zero decimal part, or is out of the possible range for a long (64-bit signed integer) result then a NumberFormatException is signalled. - toshort()
Converts the string to type short. If the string is not a number, has a non-zero decimal part, or is out of the possible range for a short (16-bit signed) result then a NumberFormatException is signalled. - toString()
Converts the string to type java.lang.String. A String object of the same length as the string is created, and the characters of the string are copied to the new string in sequence. The String is then returned.
Supplement to The NetRexx Language by Mike Cowlishaw, mfc@uk.ibm.com (ISBN 0-13-806332-X, 197pp, Prentice-Hall, 1997). |  |
|