org.maverickdbms.basic
Class ConstantString

java.lang.Object
  extended byorg.maverickdbms.basic.ConstantString
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
JavaDouble, JavaInteger, JavaLong, JavaString, mvString, ReferenceString

public abstract class ConstantString
extends java.lang.Object
implements java.lang.Comparable

This is the basic string interface for the package.


Field Summary
static ConstantString AM
           
static ConstantString EMPTY
           
static ConstantString FM
           
static ConstantString IM
           
static ConstantString LINE_SEPARATOR
           
protected static char MAX_RAISE_DELIMITER
           
protected static char MIN_RAISE_DELIMITER
           
static ConstantString ONE
           
static ConstantString RETURN_ELSE
          Return value for unsuccessful completion of function
static ConstantString RETURN_SUCCESS
          Return value for successful completion of function
static ConstantString RM
           
static ConstantString SM
           
static ConstantString SPACE
           
static ConstantString TM
           
static ConstantString VM
           
static ConstantString ZERO
           
 
Constructor Summary
ConstantString()
           
 
Method Summary
 mvString ALPHA(mvString mvn)
          Determines whether the string contains entirely alphabetic characters.
 ConstantString AND(ConstantString a)
           
 mvString ASCII(mvString result)
          Converts a ConstantString encoded in EBCDIC into ASCII
 mvString CAT(mvString result, ConstantString append)
          Appends a mvString to the current mvString.
 mvString CHANGE(mvString result, ConstantString a, ConstantString b, ConstantString occur, ConstantString begin)
           
 mvString CHAR(mvString result)
          Converts the numeric value into a ASCII value
abstract  char charAt(int index)
          Gets the char at the given position.
abstract  int compareTo(ConstantString a)
          Compares two strings lexicographically
 int compareTo(java.lang.Object o)
          Compares two strings lexicographically
 mvString CONVERT(mvString result, ConstantString a, ConstantString b)
           
 mvString COUNT(mvString count, ConstantString substr, int offset)
          Counts the number of occurrences of a substring within the string
 mvString DCOUNT(mvString dcount, ConstantString substr, int offset)
          Counts the number of substrings delimited by delim in the string.
 mvString DELETE(mvString result, ConstantString attrib, ConstantString val, ConstantString subval)
          Deletes an attribute, value or subvalue from a mvString, the corresponding delimiter is also removed
 mvString DOWNCASE(mvString result)
           
 mvString DQUOTE(mvString result)
           
 mvString DTX(mvString result, ConstantString width)
          Converts a decimal integer to hexadecimal notation
 mvString EBCDIC(mvString result)
          Converts a mvString encoded in ASCII into EBCDIC
 ConstantString EQ(ConstantString a)
          Determines whether mvs is equal to the string.
abstract  boolean equals(java.lang.Object o)
          Determines whether the object is equal to the string
 mvString EREPLACE(mvString result, ConstantString a, ConstantString b, ConstantString occur, ConstantString begin)
           
 boolean eval()
          Determines whether the string is valid
 ConstantString EXTRACT(ConstantString attrib, ConstantString val, ConstantString subval)
           
 mvString FIELD(mvString result, mvString col1, mvString col2, ConstantString delim, ConstantString field, ConstantString count)
          Returns the specified substring indexed by the delimiter
 int findLength(int start, int len, char delim)
           
 int findPosition(int a, int v, int s)
           
 ConstantString GE(MathInterface m, ConstantString a)
           
abstract  java.math.BigDecimal getBigDecimal()
          Returns a BigDecimal representation of the string.
abstract  void getChars(int srcstart, int srcend, char[] dest, int deststart)
          Copies the specified index from the string into the destination character array.
abstract  double getDouble()
          Returns a double representation of the string.
 ConstantString getReferenceString(ConstantString start, ConstantString len)
           
 ConstantString GT(MathInterface m, ConstantString a)
           
 mvString INDEX(mvString result, ConstantString substr, ConstantString numexpr)
          Returns the starting position of the specified substr
abstract  int indexOf(char c, int start)
           
 mvString INSERT(mvString result, ConstantString attrib, ConstantString val, ConstantString subval, ConstantString insert)
          Inserts the specified string at the specified attribute, value and subvalue mark.
abstract  int intValue()
          Returns the integer value of the string
abstract  boolean isIntegral()
           
abstract  boolean isNumeric()
           
 ConstantString LE(MathInterface m, ConstantString a)
           
 mvString LEN(mvString mvn)
          Returns the length of the string
abstract  int length()
          Returns the length of the string
 ConstantString LOCATEI(mvString location, ConstantString element, ConstantString attrib, ConstantString val, ConstantString subval, ConstantString start, ConstantString searchtype)
          Implementation of the (Prime) basic LOCATE statement
 ConstantString LOCATEP(mvString location, ConstantString element, ConstantString attrib, ConstantString val, ConstantString subval, ConstantString start, ConstantString searchtype)
          Implementation of the (Pick) basic LOCATE statement
abstract  long longValue()
          Returns the integer value of the string
 mvString LOWER(mvString result)
          Converts any delimiters found to the next lower level
 ConstantString LT(MathInterface m, ConstantString a)
           
 ConstantString MATCH(ConstantString pattern)
          The MATCH functions matches the specified pattern to the string.
 ConstantString NOT()
           
 mvString NUM(mvString mvn)
           
 ConstantString OR(ConstantString a)
           
 mvString RAISE(mvString result)
          Converts any delimiters found to the next higher level
 mvString REPLACE(mvString result, ConstantString attrib, ConstantString val, ConstantString subval, ConstantString replace)
          Replaces the specified string at the specified attribute, value and subvalue mark.
 void SELECT(Program program, mvString result, Key key)
          Creates a select list from the attributes of the current string
 mvString SEQ(mvString mvn)
          Returns the ascii value of a single character
 mvString SPACE(mvString result)
          Creates a string with the specified number of spaces
 mvString SQUOTE(mvString result)
           
 mvString STR(mvString result, ConstantString count)
          Returns a string composed of a given number of repeated substrings
 mvString SUM(mvString result, ConstantString begin, ConstantString end)
           
abstract  java.lang.String toString()
          The standard toString method for the object
 mvString TRIM(mvString result, ConstantString chr, ConstantString type)
          Removes the leading spaces and any concurrent spaces from the string
 mvString UPCASE(mvString result)
           
 mvString XTD(mvString result, ConstantString width)
          Converts a hexadecimal value to decimal notation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IM

public static final ConstantString IM

RM

public static final ConstantString RM

AM

public static final ConstantString AM

FM

public static final ConstantString FM

VM

public static final ConstantString VM

SM

public static final ConstantString SM

TM

public static final ConstantString TM

ZERO

public static final ConstantString ZERO

ONE

public static final ConstantString ONE

EMPTY

public static final ConstantString EMPTY

RETURN_SUCCESS

public static final ConstantString RETURN_SUCCESS
Return value for successful completion of function


RETURN_ELSE

public static final ConstantString RETURN_ELSE
Return value for unsuccessful completion of function


SPACE

public static final ConstantString SPACE

LINE_SEPARATOR

public static final ConstantString LINE_SEPARATOR

MAX_RAISE_DELIMITER

protected static final char MAX_RAISE_DELIMITER
See Also:
Constant Field Values

MIN_RAISE_DELIMITER

protected static final char MIN_RAISE_DELIMITER
See Also:
Constant Field Values
Constructor Detail

ConstantString

public ConstantString()
Method Detail

ALPHA

public mvString ALPHA(mvString mvn)
Determines whether the string contains entirely alphabetic characters.

Parameters:
mvn - the number to contain the result
Returns:
the mvString containing the result 1 for alphabetic 0 otherwise

AND

public ConstantString AND(ConstantString a)

ASCII

public mvString ASCII(mvString result)
               throws java.io.UnsupportedEncodingException
Converts a ConstantString encoded in EBCDIC into ASCII

Parameters:
result - mvString to contain the ascii translation
Returns:
the mvString containing the translation
Throws:
java.io.UnsupportedEncodingException - if the EBCDIC codepage is not present

CAT

public mvString CAT(mvString result,
                    ConstantString append)
Appends a mvString to the current mvString.

Parameters:
result - the mvString to store the concatenated string
append - the string to append
Returns:
the concatenated string

CHANGE

public mvString CHANGE(mvString result,
                       ConstantString a,
                       ConstantString b,
                       ConstantString occur,
                       ConstantString begin)

CHAR

public mvString CHAR(mvString result)
Converts the numeric value into a ASCII value

Parameters:
result - mvString for storing the ascii result
Returns:
the mvString containing the ascii result

charAt

public abstract char charAt(int index)
Gets the char at the given position.

Parameters:
index - position of char within the string
Returns:
the character

compareTo

public abstract int compareTo(ConstantString a)
Compares two strings lexicographically

Parameters:
a - string to compare
Returns:
0 if equals -ve if less than argument +ve if greater than arg

compareTo

public int compareTo(java.lang.Object o)
Compares two strings lexicographically

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - object to compare
Returns:
0 if equals -ve if less than argument +ve if greater than arg

CONVERT

public mvString CONVERT(mvString result,
                        ConstantString a,
                        ConstantString b)

COUNT

public mvString COUNT(mvString count,
                      ConstantString substr,
                      int offset)
Counts the number of occurrences of a substring within the string

Parameters:
count - mvString to contain the count
substr - the substring to be searched for
offset - increment to start searching again after successful match
Returns:
the mvString containing the count

DCOUNT

public mvString DCOUNT(mvString dcount,
                       ConstantString substr,
                       int offset)
Counts the number of substrings delimited by delim in the string.

Parameters:
dcount - the number to store the result
substr - the string to be searched for
offset - increment to start searching again after sucessful match
Returns:
the number containing the result

DELETE

public mvString DELETE(mvString result,
                       ConstantString attrib,
                       ConstantString val,
                       ConstantString subval)
Deletes an attribute, value or subvalue from a mvString, the corresponding delimiter is also removed

Parameters:
result - variable to place the resulting multivalue.
attrib - attribute to delete, if value is zero the entire attribute is deleted
val - value to delete, if subval is zero the entire value is deleted
subval - subvalue to delete.
Returns:
the mvString

DOWNCASE

public mvString DOWNCASE(mvString result)

DQUOTE

public mvString DQUOTE(mvString result)

DTX

public mvString DTX(mvString result,
                    ConstantString width)
Converts a decimal integer to hexadecimal notation

Parameters:
result - the string into which to place the output
width - the minimum size of the result If width is specified and the number is of insufficient length the resulting string is padded with leading zeroes
Returns:
the resulting string

EBCDIC

public mvString EBCDIC(mvString result)
                throws java.io.UnsupportedEncodingException
Converts a mvString encoded in ASCII into EBCDIC

Parameters:
result - mvString to contain the EBCDIC translation
Returns:
the mvString containing the translation
Throws:
java.io.UnsupportedEncodingException - if the EBCDIC codepage is not present

EQ

public ConstantString EQ(ConstantString a)
Determines whether mvs is equal to the string.

Parameters:
a - the string to be compared
Returns:
true if the string is equal to mvs

equals

public abstract boolean equals(java.lang.Object o)
Determines whether the object is equal to the string

Parameters:
o - the object to be compared

EREPLACE

public mvString EREPLACE(mvString result,
                         ConstantString a,
                         ConstantString b,
                         ConstantString occur,
                         ConstantString begin)

eval

public boolean eval()
Determines whether the string is valid

Returns:
if the string length is greater than zero and not equal to zero

EXTRACT

public ConstantString EXTRACT(ConstantString attrib,
                              ConstantString val,
                              ConstantString subval)

FIELD

public mvString FIELD(mvString result,
                      mvString col1,
                      mvString col2,
                      ConstantString delim,
                      ConstantString field,
                      ConstantString count)
Returns the specified substring indexed by the delimiter

Parameters:
result - the mvString to hold the substring
col1 - the start index
col2 - the end index
delim - the delimiter
field - the field number
count - the number of fields to return
Returns:
the specified substring

findLength

public int findLength(int start,
                      int len,
                      char delim)

findPosition

public int findPosition(int a,
                        int v,
                        int s)

indexOf

public abstract int indexOf(char c,
                            int start)

INSERT

public mvString INSERT(mvString result,
                       ConstantString attrib,
                       ConstantString val,
                       ConstantString subval,
                       ConstantString insert)
Inserts the specified string at the specified attribute, value and subvalue mark.

Parameters:
result - the string to hold the resulting dynamic array
attrib - attribute position
val - value mark position
subval - subvalue mark postion
insert - mvString to be inserted
Returns:
the resulting array

GE

public ConstantString GE(MathInterface m,
                         ConstantString a)

getBigDecimal

public abstract java.math.BigDecimal getBigDecimal()
Returns a BigDecimal representation of the string.

Returns:
the BigDecimal

getDouble

public abstract double getDouble()
Returns a double representation of the string. If the value is non-numeric zero is returned.

Returns:
the double

getChars

public abstract void getChars(int srcstart,
                              int srcend,
                              char[] dest,
                              int deststart)
Copies the specified index from the string into the destination character array.

Parameters:
srcstart - starting postion in the source string.
srcend - ending index + 1 of characters to be copied from source.
dest - the destination character array
deststart - starting position in the destination array.

getReferenceString

public ConstantString getReferenceString(ConstantString start,
                                         ConstantString len)

GT

public ConstantString GT(MathInterface m,
                         ConstantString a)

INDEX

public mvString INDEX(mvString result,
                      ConstantString substr,
                      ConstantString numexpr)
Returns the starting position of the specified substr

Parameters:
result - the starting position
substr - the substring to be searched for.
numexpr - the occurrance number of the substr.
Returns:
the starting position or zero if not found

intValue

public abstract int intValue()
Returns the integer value of the string

Returns:
the integer value.

isIntegral

public abstract boolean isIntegral()

isNumeric

public abstract boolean isNumeric()

LEN

public mvString LEN(mvString mvn)
Returns the length of the string

Parameters:
mvn - the number to store the length
Returns:
the length

length

public abstract int length()
Returns the length of the string

Returns:
the strings length

LOCATEI

public ConstantString LOCATEI(mvString location,
                              ConstantString element,
                              ConstantString attrib,
                              ConstantString val,
                              ConstantString subval,
                              ConstantString start,
                              ConstantString searchtype)
Implementation of the (Prime) basic LOCATE statement

Parameters:
location - the string to hold the resulting position
element - element to search for.
attrib - attribute to search through
val - value to search through
subval - subvalue to search through
start - index of search start
searchtype - type of search ie 'AL', 'AR', 'DL', 'DR'
Returns:
the location.

LOCATEP

public ConstantString LOCATEP(mvString location,
                              ConstantString element,
                              ConstantString attrib,
                              ConstantString val,
                              ConstantString subval,
                              ConstantString start,
                              ConstantString searchtype)
Implementation of the (Pick) basic LOCATE statement

Parameters:
location - the string to hold the resulting position
element - element to search for.
attrib - attribute to search through
val - value to search through
subval - subvalue to search through
start - index of search start
searchtype - type of search ie 'AL', 'AR', 'DL', 'DR'
Returns:
the location

LE

public ConstantString LE(MathInterface m,
                         ConstantString a)

longValue

public abstract long longValue()
Returns the integer value of the string

Returns:
the integer value.

LOWER

public mvString LOWER(mvString result)
Converts any delimiters found to the next lower level

Parameters:
result - string to contain the raised value
Returns:
the resulting string

LT

public ConstantString LT(MathInterface m,
                         ConstantString a)

MATCH

public ConstantString MATCH(ConstantString pattern)
The MATCH functions matches the specified pattern to the string.

Parameters:
pattern - the pattern to match
Returns:
whether it matched

NOT

public ConstantString NOT()

NUM

public mvString NUM(mvString mvn)

OR

public ConstantString OR(ConstantString a)

RAISE

public mvString RAISE(mvString result)
Converts any delimiters found to the next higher level

Parameters:
result - string to contain the raised value
Returns:
the resulting string

REPLACE

public mvString REPLACE(mvString result,
                        ConstantString attrib,
                        ConstantString val,
                        ConstantString subval,
                        ConstantString replace)
Replaces the specified string at the specified attribute, value and subvalue mark.

Parameters:
result - string to contain the replaced entry
attrib - attribute position
val - value mark position
subval - subvalue mark postion
replace - mvString to be inserted
Returns:
the string with the replaced entry

SELECT

public void SELECT(Program program,
                   mvString result,
                   Key key)
            throws mvException
Creates a select list from the attributes of the current string

Parameters:
program - the program the select list is bound to
result - the string to contain the select list
key - criteria for the query
Throws:
mvException

SEQ

public mvString SEQ(mvString mvn)
Returns the ascii value of a single character

Parameters:
mvn - The number to contain the ascii value
Returns:
the ascii value

SPACE

public mvString SPACE(mvString result)
Creates a string with the specified number of spaces

Parameters:
result - the string to hold the spaces
Returns:
the string

SQUOTE

public mvString SQUOTE(mvString result)

STR

public mvString STR(mvString result,
                    ConstantString count)
Returns a string composed of a given number of repeated substrings

Parameters:
result - the string to hold the repeated substrings
count - the number of repetitions
Returns:
the new string

SUM

public mvString SUM(mvString result,
                    ConstantString begin,
                    ConstantString end)

toString

public abstract java.lang.String toString()
The standard toString method for the object

Returns:
a java.lang.String representation of the object

TRIM

public mvString TRIM(mvString result,
                     ConstantString chr,
                     ConstantString type)
Removes the leading spaces and any concurrent spaces from the string

Parameters:
result - to hold the trimmed string
chr - the character to be trimmed
type - the type of trim to do.

UPCASE

public mvString UPCASE(mvString result)

XTD

public mvString XTD(mvString result,
                    ConstantString width)
Converts a hexadecimal value to decimal notation

Parameters:
result - the string into which to place the output
width - the minimum size of the result If width is specified and the number is of insufficient length the resulting string is padded with leading zeroes
Returns:
the resulting string