public abstract class Text extends BaseDataType
Modifier and Type | Class and Description |
---|---|
private class |
Text.SensitivityResetter
Helper to reset the associated instance's case sensitivity to a prior
value based on a notification that a particular scope has exited.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
caseSens
Stores the state of whether or not this instance compares case
sensitively.
|
protected static java.lang.String |
override
Charset name to use for encoding or
null for default. |
protected boolean |
unknown
Stores the state of whether or not this instance represents the
unknown value , independent of the state of this
character's data. |
protected java.lang.String |
value
Stores the state of this character as an instance of class
String . |
Constructor and Description |
---|
Text()
Default constructor, creates an instance that represents the unknown
value.
|
Text(BaseDataType value)
This is a special c'tor which should be used only when converting the
value returned by a function or method with polymorphic return type into the
expected type (i.e.
|
Text(char ch)
Constructs an instance that has a
char value passed in and which
does not represent the unknown value . |
Text(java.lang.String value)
Constructs an instance that has the
String value passed in and which
does not represent the unknown value , unless the value
argument is null . |
Text(java.lang.String value,
boolean caseSens)
Constructs an instance that has the
String value passed in and which
does not represent the unknown value , unless the value
argument is null . |
Text(Text value)
Constructs an instance that exactly matches that of the passed-in instance.
|
Text(Text value,
boolean output)
Create a new instance, by copying the state of the passed
Text . |
Modifier and Type | Method and Description |
---|---|
void |
assign(BaseDataType value,
boolean force)
Sets the state (data and unknown value) of this instance based on the state of the passed
instance.
|
void |
assign(java.lang.String value)
Sets the state (data and unknown value) of this instance based on the
state of the passed instance.
|
void |
assign(Text value)
Sets the state (data and unknown value) of this instance based on the
state of the passed instance.
|
void |
assign(Text value,
boolean force)
Sets the state (data and unknown value) of this instance based on the state of the passed
instance.
|
void |
assign(Undoable value)
Sets the state (data and unknown value) of this instance based on the state of the passed
instance.
|
int |
caseSensitiveHashCode()
Hash code implementation which is consistent with
equalsCaseSensitively(com.goldencode.p2j.util.Text) . |
private void |
checkOverlayType(java.lang.String type)
Check the overlay type description and throw an exception if the type
is not yet supported.
|
int |
compareTo(java.lang.Object obj)
Compares this instance with the specified instance and returns a -1 if this instance is less
than the specified, 0 if the two instances are equal and 1 if this instance is greater than
the specified instance.
|
void |
deepAssign(Text value)
Sets the state (data and unknown value) and configuration
(case-sensitivity) of this instance based on the state and configuration
of the passed instance.
|
boolean |
equalsCaseSensitively(Text c)
Test equality between the internal values of this object and the given parameter on a case
sensitive basis.
|
java.lang.String |
getValue()
Accesses the state of this instance's
String value
independently of the state of whether this instance represents the
unknown value . |
int |
hashCode()
Hash code implementation which is consistent with
BaseDataType.equals(java.lang.Object) . |
BaseDataType |
instantiateUnknown()
Creates a new instance of the same type that represents the
unknown value . |
boolean |
isCaseSensitive()
Determines if this instance compares case sensitively.
|
boolean |
isEmbeddedNullAllowed()
Report if existing instances that have embedded null characters are allowed to be
assigned to this instance.
|
boolean |
isUnknown()
Determines if this instance represents the
unknown value . |
static java.lang.String |
javaSpacifyNull(java.lang.String data)
Return a string which contains the contents of the given string up to
(but not including) the first
null character (ASCII 0x00)
and for that null character and all following characters
the resulting string will contain spaces. |
static java.lang.String |
javaTruncateNull(java.lang.String data)
Return a string which contains the contents of the given string up to
(but not including) the first
null character (ASCII 0x00),
the resulting string is truncated at the first null . |
Text |
maximum(Text c)
Returns the larger (lexicographically) of the current or passed-in
instance.
|
Text |
minimum(Text c)
Returns the smaller (lexicographically) of the current or passed-in
instance.
|
Text |
overlay(java.lang.String text,
double pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
double pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
double pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
double pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
double pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
NumberType pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
NumberType pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
NumberType pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
NumberType pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(java.lang.String text,
NumberType pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
double pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
double pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
double pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
double pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
double pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
NumberType pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
NumberType pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
NumberType pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
NumberType pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
overlay(Text text,
NumberType pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
static java.lang.String |
progressSpacifyNull(java.lang.String data,
boolean unixEsc)
Return a string which contains the contents of the given string up to
(but not including) the first
null character (encoded as a
Progress escape sequence) and for that null character and
all following characters the resulting string will contain spaces. |
static char |
readChar(java.lang.String input,
int index)
Test for certain failure conditions and if OK return the indexed character, otherwise throw
an exception with useful debugging information.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
Text |
replace(java.lang.String text,
double pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
double pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
double pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
double pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
double pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
double pos,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(java.lang.String text,
NumberType pos,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
double pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
double pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
double pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the passed text at the
1-based index into the string.
|
Text |
replace(Text text,
double pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
double pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the passed text at the
1-based index into the string.
|
Text |
replace(Text text,
double pos,
java.lang.String type)
Overwrites characters in the current value of this instance with the passed text at the
1-based index into the string.
|
Text |
replace(Text text,
NumberType pos)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
NumberType pos,
double len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
NumberType pos,
double len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
NumberType pos,
NumberType len)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
NumberType pos,
NumberType len,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replace(Text text,
NumberType pos,
java.lang.String type)
Overwrites characters in the current value of this instance with the
passed text at the 1-based index into the string.
|
Text |
replaceEntry(double i,
character delimit,
java.lang.String replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(double i,
character delimit,
Text replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(double ii,
char delimit,
java.lang.String replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(double i,
java.lang.String replace)
Replaces the specified 1-based indexed comma-delimited entry in the
current instance which must be a delimited list.
|
Text |
replaceEntry(double i,
java.lang.String delimit,
java.lang.String replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(double i,
java.lang.String delimit,
Text replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(double i,
Text replace)
Replaces the specified 1-based indexed comma-delimited entry in the
current instance which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
character replace)
Replaces the specified 1-based indexed comma-delimited entry in the
current instance which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
character delimit,
java.lang.String replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
character delimit,
Text replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
java.lang.String replace)
Replaces the specified 1-based indexed comma-delimited entry in the
current instance which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
java.lang.String delimit,
java.lang.String replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
Text |
replaceEntry(NumberType i,
java.lang.String delimit,
Text replace)
Replaces the specified 1-based indexed entry in the current instance
which must be a delimited list.
|
private void |
replaceWorker(Text text,
NumberType pos,
NumberType len,
boolean overlay)
Core method to implement overlay and replace support.
|
void |
setCaseSensitive(boolean caseSens)
Sets the state of this instance's compares case sensitive flag.
|
void |
setTemporaryCaseSensitive(boolean caseSens)
Sets the state of this instance's compares case sensitive flag for the
duration of the caller's current scope.
|
void |
setUnknown()
Sets the state of this instance's
unknown value flag to
true . |
void |
setValue(java.lang.String value)
Sets the state of this instance's
String value and sets the
unknown state for this instance to false . |
java.lang.String |
toJavaType()
Return the current value as a Java wrapper.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
assign, calcFormatLength, deepCopy, defaultFormatString, duplicate, elementsOfType, equals, formatLength, generateDefault, generateUnknown, getTypeName, incompatibleTypesOnConversion, initializeDefaultExtent, instantiateDefault, instantiateDefaultExtent, isUnknownValue, maximum, minimum, notUnknownValue, sameType, toString, toStringExport, toStringMessage
changed, checkUndoable, checkUndoable, checkUndoable, getTransLevel, isGlobal, isUndoable, markUndoable, popBlock, rollback, setGlobal
protected static final java.lang.String override
null
for default.protected java.lang.String value
String
. This is independent of the state of whether or
not this instance represents the unknown value
.protected boolean unknown
unknown value
, independent of the state of this
character's data.protected boolean caseSens
public Text()
public Text(BaseDataType value)
assign(BaseDataType,boolean)
).value
- The value to be used for this instance.public Text(Text value)
value
- The value of the resulting instance.public Text(java.lang.String value)
String
value passed in and which
does not represent the unknown value
, unless the value
argument is null
.
Strings (especially converted literals) can have embedded null characters, but in the 4GL
the resulting variable instances are "spacified". The given value will be processed by
javaSpacifyNull(java.lang.String)
before storing it in the new instance.
value
- The character value of the resulting instance.public Text(java.lang.String value, boolean caseSens)
String
value passed in and which
does not represent the unknown value
, unless the value
argument is null
.
Strings (especially converted literals) can have embedded null characters, but in the 4GL
the resulting variable instances are "spacified". The given value will be processed by
javaSpacifyNull(java.lang.String)
before storing it in the new instance.
value
- The character value of the resulting instance.caseSens
- Specifies whether this instance should use case sensitive
comparisons.public Text(char ch)
char
value passed in and which
does not represent the unknown value
.
If the given value is the null character, an ASCII space character will be assigned.
ch
- The character value of the resulting instance.public Text(Text value, boolean output)
Text
.
If the output
parameter is set to true
, it
means that the referenced value is saved, as the passed instance will
be passed to a function call, and the state might need to be updated
on function exit.value
- The value which needs to be copied.output
- Flag indicating if this instance is passed to as a reference
for an output parameter.public static java.lang.String javaSpacifyNull(java.lang.String data)
null
character (ASCII 0x00)
and for that null
character and all following characters
the resulting string will contain spaces.
The resulting length of the output string will be the same as the length of the input string.
This processing is needed by some operators and/or functionality that
process character
data.
This transformation is for runtime strings, NOT for Progress compatible
string literals. If a source code conversion is needed, please use
progressSpacifyNull(java.lang.String, boolean)
.
As an example, a string such as:
Input Output ---------------------------------- ---------------------------------- "This has a \0 (null) char." "This has a " "\0" " "
data
- The input string (not valid for encoding in a source file).public static java.lang.String javaTruncateNull(java.lang.String data)
null
character (ASCII 0x00),
the resulting string is truncated at the first null
.
As an example, a string such as:
Input Output ---------------------------------- ---------------------------------- "This has a \0 (null) char." "This has a " "\0" ""
data
- The input string (not valid for encoding in a source file).public static java.lang.String progressSpacifyNull(java.lang.String data, boolean unixEsc)
null
character (encoded as a
Progress escape sequence) and for that null
character and
all following characters the resulting string will contain spaces.
The resulting length of the string (in terms of the number of
characters that the string will include at runtime) will NOT change,
although the length of the string representation (as a source code
representation stored in a Java string) may be reduced as the
null
character's escape sequence (which would require 4
characters to represent as in ~000
) and any following
escaped sequences will be converted to a space which only consumes
a single character position.
The enclosing single or double quote characters are maintained (not overwritten).
This processing is needed by the Progress preprocessor and other conversion processing of string literals.
This transformation is for Progress compatible string literals, NOT for
runtime strings. If a runtime string conversion is needed, please use
javaSpacifyNull(java.lang.String)
. Both forms of the null
character escape sequence are handled.
As an example, a Progress string such as:
Input Output ---------------------------------- ---------------------------------- "This has a ~000 (null) char." "This has a " 'This has a ~000 (null) char.' 'This has a ' "~000" " " '~000' ' ' "\000" " " '\000' ' '
data
- A Progress source code representation of a string literal
which is the input string to be transformed.unixEsc
- true
if the backslash character should be
treated as an escape character.public static char readChar(java.lang.String input, int index) throws java.lang.IllegalArgumentException
input
- The string to read from.index
- The 0-based index into the string, from which to read the character.java.lang.IllegalArgumentException
- If the index is out of bounds.public boolean isEmbeddedNullAllowed()
true
. Sub-classes can override this to change the
behavior.public Text maximum(Text c)
c
- The instance to compare against.public Text minimum(Text c)
c
- The instance to compare against.public Text overlay(Text text, double pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text overlay(Text text, double pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(Text text, double pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(Text text, double pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(Text text, double pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(Text text, NumberType pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text overlay(Text text, NumberType pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(Text text, NumberType pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(Text text, NumberType pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(Text text, NumberType pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(java.lang.String text, double pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text overlay(java.lang.String text, double pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(java.lang.String text, double pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(java.lang.String text, double pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(java.lang.String text, double pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(java.lang.String text, NumberType pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text overlay(java.lang.String text, NumberType pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(java.lang.String text, NumberType pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text overlay(java.lang.String text, NumberType pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.ErrorConditionException
public Text overlay(java.lang.String text, NumberType pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace
and the number of characters from the replacement text to
include in the replacement.type
- Description of how to interpret the position and length values.
At this time only "character" is supported.ErrorConditionException
public Text replace(Text text, double pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text replace(Text text, double pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(Text text, double pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(Text text, NumberType pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text replace(Text text, NumberType pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(Text text, NumberType pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(java.lang.String text, double pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text replace(java.lang.String text, double pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(java.lang.String text, double pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos, double len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos, NumberType len) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.ErrorConditionException
public Text replace(Text text, double pos, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(Text text, double pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(Text text, double pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(Text text, NumberType pos, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(Text text, NumberType pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(Text text, NumberType pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, double pos, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, double pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, double pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos, double len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replace(java.lang.String text, NumberType pos, NumberType len, java.lang.String type) throws ErrorConditionException
text
- Replacement text.pos
- The 1-based index into the string at which the replacement is to occur.len
- The number of characters in the source string to replace.type
- Specifies whether this substring operates on "CHARACTER" (default), "RAW" or
"COLUMN". At this time "character" is supported.ErrorConditionException
public Text replaceEntry(double ii, char delimit, java.lang.String replace) throws ErrorConditionException
ii
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.ErrorConditionException
public Text replaceEntry(double i, Text replace) throws ErrorConditionException
i
- The 1-based index into the list.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(double i, character delimit, Text replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(double i, character delimit, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(double i, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.replace
- The replacment text.ErrorConditionException
public Text replaceEntry(double i, java.lang.String delimit, Text replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(double i, java.lang.String delimit, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.ErrorConditionException
public Text replaceEntry(NumberType i, character replace) throws ErrorConditionException
i
- The 1-based index into the list.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(NumberType i, character delimit, Text replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(NumberType i, character delimit, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(NumberType i, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(NumberType i, java.lang.String delimit, Text replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public Text replaceEntry(NumberType i, java.lang.String delimit, java.lang.String replace) throws ErrorConditionException
i
- The 1-based index into the list.delimit
- The delimiter character.replace
- The replacment text.unknown value
if any of the inputs are
unknown value
.ErrorConditionException
public BaseDataType instantiateUnknown()
unknown value
.instantiateUnknown
in class BaseDataType
unknown value
.public void assign(BaseDataType value, boolean force)
If the value is not of type Text
, the following automatic type conversions
will occur:
unknown - sets the instance to unknown value Text - assigns normally all other cases - the result of toStringMessage() is assigned
This variant is meant to handle the cases of built-in functions and methods in the 4GL which have polymorphic return types (e.g. DYNAMIC-FUNCTION()). This should NOT be used for non-polymorphic assignments.
It is possible that string data could have embedded null characters , but in the 4GL
the resulting variable instances are "spacified". The given value will be processed by
javaSpacifyNull(java.lang.String)
before storing it in the new instance.
assign
in class BaseDataType
value
- The instance from which to copy state.force
- Flag to indicate if a pending error should be ignored (see
ErrorManager.isPendingError()
and the assignment forced regardless. Note
that normal assignment silently exits with no change if there is a pending error.
If this flag is true
, that check is bypassed and the assignment will
always be done.public void assign(Text value)
deepAssign(com.goldencode.p2j.util.Text)
if both state and
configuration must be set.
This is a "no operation" in the case where silent error mode is active
AND an error has occurred in the current processing since the opening
call to ErrorManager.silentErrorEnable()
. This protection is
needed to ensure that the state of this instance does not change in
this case. This will not affect undo because that only occurs when
silent error mode is disabled.
value
- The instance from which to copy state.public void assign(Text value, boolean force)
This form of assignment allows embedded null characters to be assigned from one already existing instance to another if the child class allows it.
value
- The instance from which to copy state.force
- Flag to indicate if a pending error should be ignored (see
ErrorManager.isPendingError()
and the assignment forced regardless. Note
that normal assignment silently exits with no change if there is a pending error.
If this flag is true
, that check is bypassed and the assignment will
always be done.public void assign(java.lang.String value)
deepAssign(com.goldencode.p2j.util.Text)
if both state and
configuration must be set.
This is a "no operation" in the case where silent error mode is active
AND an error has occurred in the current processing since the opening
call to ErrorManager.silentErrorEnable()
. This protection is
needed to ensure that the state of this instance does not change in
this case. This will not affect undo because that only occurs when
silent error mode is disabled.
value
- The instance from which to copy state. If null
is passed, the instance will be set to the unknown value.public void assign(Undoable value)
value
- The instance from which to copy state.public void deepAssign(Text value)
value
- The instance from which to copy state and configuration.public java.lang.String getValue()
String
value
independently of the state of whether this instance represents the
unknown value
. If this instance represents the
unknown value
, the returned String
is
not valid!String
value.public void setValue(java.lang.String value)
String
value and sets the
unknown
state for this instance to false
.
Strings data can have embedded null characters, but in the 4GL the resulting variable
instances are "spacified". The given value will be processed by javaSpacifyNull(java.lang.String)
before storing it in the new instance.
value
- The state to set this instance's String
value.public boolean isCaseSensitive()
true
if this instance is set to case sensitive.public void setCaseSensitive(boolean caseSens)
This method is used to set the current value in a manner that does not
schedule an automated reset to the prior value later. Thus, this method
is suitable for the initial configuration of a new instance. If a
temporary case-sensitivity change is needed, use
setTemporaryCaseSensitive(boolean)
.
caseSens
- true
if this instance must be set to case
sensitive.public void setTemporaryCaseSensitive(boolean caseSens)
This method should only be used when importing references via the
SharedVariableManager
as a local instance or a new shared
instance would not need to be reset, since they would have no prior
value to which to return. To set the initial case-sensitivity, please
se setCaseSensitive(boolean)
.
The TransactionManager.registerFinalizable(com.goldencode.p2j.util.Finalizable, boolean)
facility is used to
obtain the callback necessary to reset the sensitivity at end of the
caller's scope.
caseSens
- true
if this instance must be set to case
sensitive.public boolean equalsCaseSensitively(Text c)
true
is returned. If only one is unknown,
false
is returned. Otherwise, the case sensitive test is performed.c
- Another character instance to test for case sensitive equality with this object.true
if this object and the given object test as equal, else false
.public int caseSensitiveHashCode()
equalsCaseSensitively(com.goldencode.p2j.util.Text)
.public boolean isUnknown()
unknown value
.isUnknown
in class BaseDataType
true
if this instance is set to the
unknown value
.public void setUnknown()
unknown value
flag to
true
.
Warning: a separate call is needed to ensure that the data of this instance is set to the correct value.
setUnknown
in class BaseDataType
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.public int compareTo(java.lang.Object obj)
Comparable
interface.
Core worker that handles comparisons between 2 string operands after removing trailing spaces and honoring the case sensitivity operands.
Case-insensitive comparisons are obtained by manually uppercasing both operands which is how
Progress does it. Lowercase comparisons cannot be used because the results for
CompareOps.isGreaterThan(com.goldencode.p2j.util.BaseDataType, com.goldencode.p2j.util.BaseDataType)
, CompareOps.isLessThan(com.goldencode.p2j.util.BaseDataType, com.goldencode.p2j.util.BaseDataType)
,
CompareOps.isGreaterThanOrEqual(com.goldencode.p2j.util.BaseDataType, com.goldencode.p2j.util.BaseDataType)
and CompareOps.isLessThanOrEqual(com.goldencode.p2j.util.BaseDataType, com.goldencode.p2j.util.BaseDataType)
would be
different in Java than in Progress when the following characters are included in the string:
[ \ ^ _ '
The algorithm will fail to give meaningful results in the case where one tries to sort against other objects that do not represent compatible values.
obj
- The instance to compare against.obj
.public int hashCode()
BaseDataType.equals(java.lang.Object)
.hashCode
in class BaseDataType
public java.lang.String toJavaType()
null
if unknown.private void checkOverlayType(java.lang.String type)
type
- Must be "character" at this time.java.lang.IllegalArgumentException
- If the type doesn't match "character".private void replaceWorker(Text text, NumberType pos, NumberType len, boolean overlay) throws ErrorConditionException
pos
with the text
specified by text
. The number of replaced characters
is specified by len
, with a negative number indicating
that the length of characters in text
is used. If
overlay
mode is requested, then the len
parameter also limits the number of characters in the text
parameter which will be used as the replacement. If any of the
parameters are unknown value
, the instance will be set
to the unknown value
.text
- Replacement text.pos
- The 1-based index into the string at which the replacement
is to occur.len
- The number of characters in the source string to replace.overlay
- true
if overlay mode is required.ErrorConditionException