public class DateFormat extends DisplayFormat
date variables.| Modifier and Type | Class and Description |
|---|---|
private class |
DateFormat.DateBuf
Internal form of date data.
|
private static class |
DateFormat.DateComponent
The simple structure which records what places are occupied in a screen
value by the date component.
|
private class |
DateFormat.TestCase
Simple testcase wrapper to check the year autocompletion and its
string-to-number conversion.
|
DisplayFormat.Presentation| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
dateCompOrder
Order of date components for rendering.
|
protected int |
DAY_IDX
Index of the day component in the arrays of parsed components.
|
(package private) static java.util.regex.Pattern |
digitsPattern
One or more digits regexp
|
protected DateFormat.DateComponent[] |
fmtDateComps
How date components are positioned in rendered string.
|
protected boolean |
fmtFullYear
true for a 4-digit year. |
(package private) static java.util.regex.Pattern |
integerPattern
Signed integer regexp
|
protected int |
MONTH_IDX
Index of the month component in the arrays of parsed components.
|
protected ParsedDateFormat |
parsed
Parsed format string.
|
protected int |
YEAR_IDX
Index of the year component in the arrays of parsed components.
|
editableSource, fmtScreenWidth| Modifier | Constructor and Description |
|---|---|
protected |
DateFormat(DateFormat orig)
Create a copy the original format.
|
|
DateFormat(java.lang.String pformat)
Constructs a date format from the given Progress format string.
|
| Modifier and Type | Method and Description |
|---|---|
DisplayFormat.Presentation |
clear(DisplayFormat.Presentation pres)
Returns a new presentation instance with a default initialized insert
mode and cursor position.
|
DisplayFormat |
duplicate()
Duplicate this instance.
|
private static int |
extractNumber(java.lang.String s)
Parse argument for a sequence of at least one digit and parse the result
as an integer.
|
private static int |
extractParseComponent(java.lang.String src,
int startIdx,
int length,
int maxLength,
java.util.List<ErrorManager.ErrorEntry> errors)
Extract a substring from the argument and parse it as unsigned integer.
|
DisplayFormat.Presentation |
fromVar(BaseDataType var)
Initializes a presentation for variable's value.
|
private static void |
handleDateError(int errno,
java.util.List<ErrorManager.ErrorEntry> errors)
Report or raise a numbered date parse error.
|
protected boolean |
hasFmtSeparator()
Report if the format string includes separators.
|
boolean |
isFormatCheck()
Verify if this format needs explicit validation.
|
static void |
main(java.lang.String[] args)
Start all year autocompletion and its string-to-number conversion
testcases.
|
(package private) static int |
safeParseInteger(java.lang.String s,
java.util.function.IntSupplier defaultValue)
Parse text into an integer, do not throw exceptions
|
void |
test()
Execute all year autocompletion and its string-to-number conversion testcases.
|
private static date |
toDateNoDelimiters(java.lang.String src,
int maxLength,
boolean year4digits,
java.util.List<ErrorManager.ErrorEntry> errors)
Parse a string to a date for formats with no delimiters.
|
clear, formatScreenValue, fromVar4FieldValue, generateQuestions, generateSpaces, genValueCannotBeDisplayedError, getFormatDef, getScreenWidth, instanceOfType, instanceOfType, instanceOfType, isCharInterface, isRightPositioning, isZapSupported, setCharInterface, setEditableSourceprotected byte[] dateCompOrder
protected int DAY_IDX
protected DateFormat.DateComponent[] fmtDateComps
protected boolean fmtFullYear
true for a 4-digit year.protected int MONTH_IDX
protected final ParsedDateFormat parsed
protected int YEAR_IDX
static final java.util.regex.Pattern digitsPattern
static final java.util.regex.Pattern integerPattern
public DateFormat(java.lang.String pformat)
throws ErrorConditionException
pformat - Progress format string.ErrorConditionException - When passed format is not a valid date format.protected DateFormat(DateFormat orig)
orig - The format to copy.public static void main(java.lang.String[] args)
args - Command line arguments.static final int safeParseInteger(java.lang.String s,
java.util.function.IntSupplier defaultValue)
s - source stringdefaultValue - call this if the source cannot be parsed into an integer.private static final int extractNumber(java.lang.String s)
s - the source stringprivate static int extractParseComponent(java.lang.String src,
int startIdx,
int length,
int maxLength,
java.util.List<ErrorManager.ErrorEntry> errors)
src - the source stringstartIdx - the start index to extractlength - the component lengthmaxLength - component end limiterrors - if not null, then the first error encountered
will be appended to the list, and 0 will be returned.
otherwise errors will be thrown.private static final void handleDateError(int errno,
java.util.List<ErrorManager.ErrorEntry> errors)
errno - the error numbererrors - if not null, then the first error encountered
will be appended to the list, and 0 will be returned.
otherwise errors will be thrown.private static final date toDateNoDelimiters(java.lang.String src, int maxLength, boolean year4digits, java.util.List<ErrorManager.ErrorEntry> errors)
null is returned.src - the string to parsemaxLength - the length to parseyear4digits - if true the year is 4 digits, otherwise 2 digitserrors - optional errors, if not null, then error entries will be appended
to this list instead or being thrownnull in case of parse errorpublic DisplayFormat.Presentation clear(DisplayFormat.Presentation pres)
clear in class DisplayFormatpres - A Presentation instance which was constructed by this format.
May be null. This presentation instance is not
changed in this method.public DisplayFormat duplicate()
duplicate in class DisplayFormatpublic DisplayFormat.Presentation fromVar(BaseDataType var) throws DisplayFormatCheckException
fromVar in class DisplayFormatvar - Variable which should be compatible with format.DisplayFormatCheckException - Variable's value is incompatible with format.public boolean isFormatCheck()
isFormatCheck in class DisplayFormattrue.public void test()
protected boolean hasFmtSeparator()
true if the format string had a separator.