|
IMC Epclient 5.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.enterprise.fmt.IFmt
at.spardat.enterprise.fmt.ABcdFmt
at.spardat.enterprise.fmt.ABcdFmtDefault
This implementation allows to parse and format internationalized numbers. It's a performance optimized implementation to support formatting and parsing of values coming from ABcds.
The internal encoding is the canonical encoding defined in class ABcd, i.e., decimal separator is the point, for example 100000.23.
| Field Summary | |
static int |
NK_ERROR
|
static int |
NK_TRUNC
|
| Fields inherited from class at.spardat.enterprise.fmt.ABcdFmt |
NO_NEG, NO_THOUS_SEPS, ROUND_FRACTION, SUPPRESS_ZERO, THOUS_SEPS |
| Fields inherited from class at.spardat.enterprise.fmt.IFmt |
DEFAULT, LAST_STYLE, MANDATORY, style_ |
| Constructor Summary | |
ABcdFmtDefault(int maxBeforeC,
int maxAfterC,
int style,
java.util.Locale l)
Constructs an ABcdFmt. |
|
| Method Summary | |
java.lang.String |
format(java.lang.String internal)
Transforms an internal encoding to an external. |
static java.lang.String |
format(java.lang.String canonic,
char tSep,
char decSep,
int numNachKomma)
Takes a canonic string as input and returns a formatted string. |
int |
getMaxAfterC()
Returns maximum number of digits after decimal separator or -1, if number of digits after decimal separator is unrestricted. |
int |
getMaxBeforeC()
Return maximum number of digits before decimal separator or -1, if number of digits before decimal separator is unrestricted. |
boolean |
isLegalExternalChar(char aChar)
Examines whether a given character may be part of an external representation. |
boolean |
isLegalInternal(java.lang.String v)
Determines if the given string is a legal internal representation. |
boolean |
isOneWay()
An IFmt is one way, if the external encoding may be generated out of the internal, but not vice versa. |
int |
maxLenOfExternal()
Returns the maximum length an external string representation may have. |
java.lang.String |
parse(java.lang.String external)
Tries to transform an external encoding to an internal. |
static void |
parse(java.lang.String in,
java.lang.StringBuffer result,
int maxVK,
int maxNK,
char tSep,
char decSep,
int excessNKMode)
This method parses an external representation of a ABcd and converts it to the canonic format. |
void |
set(int maxBeforeC,
int maxAfterC,
int style,
java.util.Locale l)
Allows to set all parameters that determine the formatting process. |
void |
setMaxAfterC(int maxAfterC_)
Sets maximum number of digits after decimal separator. |
void |
setMaxBeforeC(int maxBeforeC_)
Sets maximum number of digits before the decimal separator. |
void |
setStyle(int style_)
Sets the style. |
| Methods inherited from class at.spardat.enterprise.fmt.ABcdFmt |
getInstance, getInstance, getInstance, mayBeAppliedTo |
| Methods inherited from class at.spardat.enterprise.fmt.IFmt |
checkMandatory, clone, getStyle, isMandatory, setMandatory |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int NK_TRUNC
public static final int NK_ERROR
| Constructor Detail |
public ABcdFmtDefault(int maxBeforeC,
int maxAfterC,
int style,
java.util.Locale l)
set(int, int, int, java.util.Locale)| Method Detail |
public void set(int maxBeforeC,
int maxAfterC,
int style,
java.util.Locale l)
maxBeforeC - max number of digits before the comma or -1 if unrestricted. Must not be zero.maxAfterC - max number of digits after the comma or -1 if unrestrictedstyle - may be DEFAULT, MANDATORY, NO_THOUS_SEPS, THOUS_SEPS, NO_NEG or ROUND_FRACTION.
Either NO_THOUS_SEPS or THOUS_SEPS may be specified.l - the Locale. Must not be null.
java.lang.IllegalArgumentException - if maxBeforeC is zeropublic void setMaxAfterC(int maxAfterC_)
public void setMaxBeforeC(int maxBeforeC_)
public int getMaxAfterC()
public int getMaxBeforeC()
public void setStyle(int style_)
public java.lang.String format(java.lang.String internal)
IFmt
format in class IFmtinternal - the provided internal encoding. This String must satisfy the
condition isLegalInternal(), otherwise the behaviour of this
method is undefined.
IFmt.format(String)public boolean isLegalExternalChar(char aChar)
IFmt
isLegalExternalChar in class IFmtaChar - the character to check
IFmt.isLegalExternalChar(char)public boolean isLegalInternal(java.lang.String v)
IFmt
isLegalInternal in class IFmtv - the internal encoding.
IFmt.isLegalInternal(String)public boolean isOneWay()
IFmt
isOneWay in class IFmtIFmt.isOneWay()public int maxLenOfExternal()
IFmt
maxLenOfExternal in class IFmtIFmt.maxLenOfExternal()
public java.lang.String parse(java.lang.String external)
throws AParseException
IFmt
parse in class IFmtexternal - the external encoding
AParseException - if the external encoding cannot be successfully parsed.IFmt.parse(String)
public static void parse(java.lang.String in,
java.lang.StringBuffer result,
int maxVK,
int maxNK,
char tSep,
char decSep,
int excessNKMode)
in - the input string. May contain leading and trailing zeros.result - must be an empty StringBuffer which is going to hold the result.
The computed string in the canonic format, which may be safely assigned to an ABcd, if the precision
attributes maxVK and maxNK are drawn from it. An empty string is returned
if in is empty or just consists of blanks.maxVK - maximum number of digits in front of the decimal point. Specify -1, if no
restriction should be imposed.maxNK - maximum number of digits after the decimal point or -1, if no restriction
should be applied.tSep - A thousands separation character, which is generally ignored in the
part before the comma. May be 0, then in must not contain thousand
separation characters.decSep - The decimal separation character expected in the input.excessNKMode - either NK_TRUNC or NK_ERROR. Defines how to react if more
than maxNK places after the decimal point are present (after removing
trailing zeros).
FmtParseException - if in cannot be converted to the internal format.
public static java.lang.String format(java.lang.String canonic,
char tSep,
char decSep,
int numNachKomma)
canonic - canonic format string of a ABcdtSep - if not equal to zero, this character is inserted
at thousand separation positiondecSep - this character is used as decimal point character
in the resultnumNachKomma - if greater than or equal zero, the result will
have numNachKomma places after the decimal point.
If it is -1, the result consists of as many digits
after the comma as necessary.
|
IMC Epclient 5.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||