org.maverickdbms.basic.string
Class BasicString

java.lang.Object
  extended byorg.maverickdbms.basic.ConstantString
      extended byorg.maverickdbms.basic.mvString
          extended byorg.maverickdbms.basic.string.BasicString
All Implemented Interfaces:
java.lang.Comparable

public class BasicString
extends mvString


Field Summary
 
Fields inherited from class org.maverickdbms.basic.mvString
factory
 
Fields inherited from class org.maverickdbms.basic.ConstantString
AM, EMPTY, FM, IM, LINE_SEPARATOR, MAX_RAISE_DELIMITER, MIN_RAISE_DELIMITER, ONE, RETURN_ELSE, RETURN_SUCCESS, RM, SM, SPACE, TM, VM, ZERO
 
Constructor Summary
BasicString(Factory f)
           
 
Method Summary
 mvString append(char c)
          Append a single character to the string
 mvString append(ConstantString mvs)
          Append a string to the current string
 mvString append(ConstantString mvs, int start, int len)
          Append a string segment to the current string
 mvString append(java.lang.String s)
          Append a java string to the current string
 ConstantString ASSIGNED()
          Whether a value has been to the string
 char charAt(int index)
          Returns the character at the specified index.
 void clear()
          Clears the string of data
 int compareTo(ConstantString a)
          Compares two strings lexicographically
 mvString DCOUNT(mvString result, ConstantString substr, int offset)
          Counts the number of substrings delimited by delim in the string.
 mvString DELETE(ConstantString attrib, ConstantString val, ConstantString subval)
          Deletes an attribute, value or subvalue from a mvString, the corresponding delimiter is also removed
 boolean equals(java.lang.Object o)
          Determines whether the object is equal to the string
 ConstantString EXTRACT(ConstantString attrib, ConstantString val, ConstantString subval)
           
 int findLength(int start, int len, char delim)
           
 int findPosition(int a, int v, int s)
           
 Array getArray()
           
 java.math.BigDecimal getBigDecimal()
          Returns a BigDecimal representation of the string.
 void getChars(int srcstart, int srcend, char[] dest, int deststart)
          Copies the specified index from the string into the destination character array.
 double getDouble()
          Returns a double representation of the string.
 File getFile()
           
 List getList()
           
 OSFile getOSFile()
           
 Program getProgram()
          Resolve value as program
 SequentialFile getSequentialFile()
           
 int indexOf(char c, int start)
           
 mvString INSERT(ConstantString attrib, ConstantString val, ConstantString subval, ConstantString insert)
           
 int intValue()
          Returns the integer value of the string
 boolean isIntegral()
           
 boolean isNumeric()
           
 int length()
          Returns the length of the string
 long longValue()
          Returns the integer value of the string
 ConstantString REMOVE(mvString colpos, mvString delim)
          REMOVE sequentially extracts elements from the string
 mvString REPLACE(ConstantString attrib, ConstantString val, ConstantString subval, ConstantString replace)
          Replaces the specified string at the specified attribute, value and subvalue mark.
 void replace(ConstantString mvs, int start, int offset, int len)
           
 void SELECT(Program program, mvString result, Key key)
          Returns a select list from the current string.
 void set(java.math.BigDecimal num)
           
 void set(char c)
           
 void set(char[] c, int start, int len)
           
 void set(ConstantString mvs)
           
 void set(ConstantString mvs, int start, int len)
           
 void set(double num)
           
 void set(int num)
           
 void set(long num)
           
 void set(java.lang.String s)
           
 void setArray(Array array)
           
 void setCharAt(int index, char c)
           
 void setFile(File file)
           
 void setLength(int len)
           
 void setList(List list)
           
 void setProgram(Program program)
           
 java.lang.String toString()
          The standard toString method for the object
 
Methods inherited from class org.maverickdbms.basic.ConstantString
ALPHA, AND, ASCII, CAT, CHANGE, CHAR, compareTo, CONVERT, COUNT, DELETE, DOWNCASE, DQUOTE, DTX, EBCDIC, EQ, EREPLACE, eval, FIELD, GE, getReferenceString, GT, INDEX, INSERT, LE, LEN, LOCATEI, LOCATEP, LOWER, LT, MATCH, NOT, NUM, OR, RAISE, REPLACE, SEQ, SPACE, SQUOTE, STR, SUM, TRIM, UPCASE, XTD
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicString

public BasicString(Factory f)
Method Detail

append

public mvString append(char c)
Description copied from class: mvString
Append a single character to the string

Specified by:
append in class mvString
Parameters:
c - the character
Returns:
the resulting string

append

public mvString append(java.lang.String s)
Description copied from class: mvString
Append a java string to the current string

Specified by:
append in class mvString
Parameters:
s - the java string
Returns:
the resulting string

append

public mvString append(ConstantString mvs)
Description copied from class: mvString
Append a string to the current string

Specified by:
append in class mvString
Parameters:
mvs - the string
Returns:
the resulting string

append

public mvString append(ConstantString mvs,
                       int start,
                       int len)
Description copied from class: mvString
Append a string segment to the current string

Specified by:
append in class mvString
Parameters:
mvs - the string
start - the starting position
len - the length to append
Returns:
the resulting string

ASSIGNED

public ConstantString ASSIGNED()
Description copied from class: mvString
Whether a value has been to the string

Specified by:
ASSIGNED in class mvString
Returns:
1 if assigned, 0 otherwise

charAt

public char charAt(int index)
Returns the character at the specified index.

Specified by:
charAt in class ConstantString
Parameters:
index - position of char within the string
Returns:
the character.

clear

public void clear()
Description copied from class: mvString
Clears the string of data

Specified by:
clear in class mvString

compareTo

public int compareTo(ConstantString a)
Description copied from class: ConstantString
Compares two strings lexicographically

Specified by:
compareTo in class ConstantString
Parameters:
a - string to compare
Returns:
0 if equals -ve if less than argument +ve if greater than arg

DCOUNT

public mvString DCOUNT(mvString result,
                       ConstantString substr,
                       int offset)
Description copied from class: ConstantString
Counts the number of substrings delimited by delim in the string.

Overrides:
DCOUNT in class ConstantString
Parameters:
result - 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(ConstantString attrib,
                       ConstantString val,
                       ConstantString subval)
Deletes an attribute, value or subvalue from a mvString, the corresponding delimiter is also removed

Specified by:
DELETE in class mvString
Parameters:
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

equals

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

Specified by:
equals in class ConstantString
Parameters:
o - the object to be compared

EXTRACT

public ConstantString EXTRACT(ConstantString attrib,
                              ConstantString val,
                              ConstantString subval)
Overrides:
EXTRACT in class ConstantString

findLength

public int findLength(int start,
                      int len,
                      char delim)
Overrides:
findLength in class ConstantString

findPosition

public int findPosition(int a,
                        int v,
                        int s)
Overrides:
findPosition in class ConstantString

indexOf

public int indexOf(char c,
                   int start)
Specified by:
indexOf in class ConstantString

INSERT

public mvString INSERT(ConstantString attrib,
                       ConstantString val,
                       ConstantString subval,
                       ConstantString insert)
Specified by:
INSERT in class mvString

getArray

public Array getArray()
Specified by:
getArray in class mvString

getBigDecimal

public java.math.BigDecimal getBigDecimal()
Description copied from class: ConstantString
Returns a BigDecimal representation of the string.

Specified by:
getBigDecimal in class ConstantString
Returns:
the BigDecimal

getChars

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

Specified by:
getChars in class ConstantString
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.

getDouble

public double getDouble()
Description copied from class: ConstantString
Returns a double representation of the string. If the value is non-numeric zero is returned.

Specified by:
getDouble in class ConstantString
Returns:
the double

getProgram

public Program getProgram()
                   throws mvException
Description copied from class: mvString
Resolve value as program

Specified by:
getProgram in class mvString
Throws:
mvException

getFile

public File getFile()
Specified by:
getFile in class mvString

getList

public List getList()
Specified by:
getList in class mvString

getOSFile

public OSFile getOSFile()
Specified by:
getOSFile in class mvString

getSequentialFile

public SequentialFile getSequentialFile()
Specified by:
getSequentialFile in class mvString

intValue

public int intValue()
Description copied from class: ConstantString
Returns the integer value of the string

Specified by:
intValue in class ConstantString
Returns:
the integer value.

isIntegral

public boolean isIntegral()
Specified by:
isIntegral in class ConstantString

isNumeric

public boolean isNumeric()
Specified by:
isNumeric in class ConstantString

length

public int length()
Returns the length of the string

Specified by:
length in class ConstantString
Returns:
the length

longValue

public long longValue()
Description copied from class: ConstantString
Returns the integer value of the string

Specified by:
longValue in class ConstantString
Returns:
the integer value.

REMOVE

public ConstantString REMOVE(mvString colpos,
                             mvString delim)
Description copied from class: mvString
REMOVE sequentially extracts elements from the string

Specified by:
REMOVE in class mvString
Parameters:
colpos - column position of element extracted
delim - delimiter type encountered
Returns:
the extracted element

replace

public void replace(ConstantString mvs,
                    int start,
                    int offset,
                    int len)
Specified by:
replace in class mvString

REPLACE

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

Specified by:
REPLACE in class mvString
Parameters:
attrib - attribute position
val - value mark position
subval - subvalue mark postion
replace - mvString to be replaced
Returns:
result string containing the replaced entry

SELECT

public void SELECT(Program program,
                   mvString result,
                   Key key)
            throws mvException
Returns a select list from the current string. If the string is of type File, then the select will occur against the database. If the string is of any other type then the resulting list consists of the attributes from the string.

Overrides:
SELECT in class ConstantString
Parameters:
result - the variable to hold the List
key - criteria for select
program - the program the select list is bound to
Throws:
mvException

set

public void set(char[] c,
                int start,
                int len)
Specified by:
set in class mvString

set

public void set(ConstantString mvs)
Specified by:
set in class mvString

set

public void set(ConstantString mvs,
                int start,
                int len)
Specified by:
set in class mvString

set

public void set(java.lang.String s)
Specified by:
set in class mvString

set

public void set(java.math.BigDecimal num)
Specified by:
set in class mvString

set

public void set(char c)
Specified by:
set in class mvString

set

public void set(double num)
Specified by:
set in class mvString

set

public void set(int num)
Specified by:
set in class mvString

set

public void set(long num)
Specified by:
set in class mvString

setArray

public void setArray(Array array)
Specified by:
setArray in class mvString

setCharAt

public void setCharAt(int index,
                      char c)
Specified by:
setCharAt in class mvString

setLength

public void setLength(int len)
Specified by:
setLength in class mvString

setProgram

public void setProgram(Program program)
Specified by:
setProgram in class mvString

setFile

public void setFile(File file)
Specified by:
setFile in class mvString

setList

public void setList(List list)
Specified by:
setList in class mvString

toString

public java.lang.String toString()
Description copied from class: ConstantString
The standard toString method for the object

Specified by:
toString in class ConstantString
Returns:
a java.lang.String representation of the object