public class NumberFormat extends DisplayFormat
integer
, int64
and decimal
variables.Modifier and Type | Class and Description |
---|---|
private class |
NumberFormat.NumberBuf
Internal form of a number.
|
private class |
NumberFormat.NumberBufChar
Implements the CHUI presentation of the input number.
|
private class |
NumberFormat.NumberBufGui
Implements the GUI presentation of the input number.
|
DisplayFormat.Presentation
Modifier and Type | Field and Description |
---|---|
private boolean |
clearLeadingZeros
Clear leading zeros for Z format.
|
private static decimal |
DECIMALZERO
Allows quick comparisons with zero.
|
protected int |
fmtFractDigitsCount
Number of '9' chars after period.
|
protected int |
fmtFractSharedCount
Number of '<' chars.
|
protected boolean |
fmtHavePeriod
Is decimal period present?
|
protected int |
fmtIntDigitsCount
Number of 'Z' or '9' or '*' chars before period.
|
protected int |
fmtIntSharedCount
Number of '>' chars.
|
protected int |
fmtIntZerosCount
Number of '9' chars before period.
|
protected NumberType.FormatSpec |
fs
Stores parsed format string metrics.
|
private boolean |
isSilentMode
The silent mode
|
private boolean |
rightAligned
Control format alignment.
|
private boolean |
splitFormat
Complex format with split alignment.
|
editableSource, fmtScreenWidth
Constructor and Description |
---|
NumberFormat(java.lang.String pformat)
Constructs a number (decimal, int64 or integer) format from a Progress
compatible format string.
|
NumberFormat(java.lang.String pformat,
boolean isSilentMode)
Constructs a number (decimal, int64 or integer) format from a Progress
compatible 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.Presentation |
fromVar(BaseDataType var)
Initializes a presentation for variable's value.
|
private static BaseDataType |
getNumberFromScreenValue(java.lang.String numberTypePresentation,
java.lang.String screenValue)
Gets the number that has this given screen value.
|
boolean |
isRightPositioning()
Indicates if the screen value or a column's title could be formatted
with trimming from the left and right alignment based on this format.
|
boolean |
isSplitFormat()
Indicates if current output is split format
|
static BaseDataType |
parseNumber(boolean isChui,
java.lang.String numberTypePresentation,
java.lang.String format,
java.lang.String screenValue)
Parses the screen value of the given numeric type into the variable of this type.
|
private int |
signSize(int signType)
Calculates the number of characters in a sign representation.
|
clear, formatScreenValue, generateQuestions, generateSpaces, genValueCannotBeDisplayedError, getFormatDef, getScreenWidth, instanceOfType, instanceOfType, instanceOfType, isCharInterface, isFormatCheck, isZapSupported, setCharInterface, setEditableSource
private static final decimal DECIMALZERO
protected NumberType.FormatSpec fs
protected boolean fmtHavePeriod
protected int fmtIntSharedCount
protected int fmtIntDigitsCount
protected int fmtIntZerosCount
protected int fmtFractDigitsCount
protected int fmtFractSharedCount
private boolean rightAligned
private boolean splitFormat
private boolean clearLeadingZeros
private boolean isSilentMode
public NumberFormat(java.lang.String pformat, boolean isSilentMode)
pformat
- Progress format string.public NumberFormat(java.lang.String pformat)
pformat
- Progress format string.public boolean isRightPositioning()
This value only notes if this format supports such trimming/alignment but it doesn't specify if it should be applied in every case (which may be a configuration option for a given caller).
isRightPositioning
in class DisplayFormat
true
.public boolean isSplitFormat()
public DisplayFormat.Presentation clear(DisplayFormat.Presentation pres)
clear
in class DisplayFormat
pres
- A Presentation instance which was constructed by this format.
May be null
. This presentation instance is not
changed in this method.public DisplayFormat.Presentation fromVar(BaseDataType var) throws DisplayFormatCheckException
fromVar
in class DisplayFormat
var
- Variable which should be compatible with format.DisplayFormatCheckException
- Variable's value is incompatible with format.public static BaseDataType parseNumber(boolean isChui, java.lang.String numberTypePresentation, java.lang.String format, java.lang.String screenValue)
isChui
- The character interface indicatornumberTypePresentation
- The number type represented by a stringformat
- The number format stringscreenValue
- The given screen value, may be null
private static BaseDataType getNumberFromScreenValue(java.lang.String numberTypePresentation, java.lang.String screenValue)
numberTypePresentation
- The number type represented by a stringscreenValue
- The given screen value, may be null
private int signSize(int signType)
signType
- encoding of sign type