Methods Summary |
---|
public void | close()close a RuleBasedNumberFormat
if(this.addr != 0) {
closeRBNFImpl(this.addr);
this.addr = 0;
}
|
private static native void | closeRBNFImpl(int addr)
|
protected void | finalize()
close();
|
public java.lang.StringBuffer | format(long value, java.lang.StringBuffer buffer, java.text.FieldPosition field)
if(buffer == null) {
throw new NullPointerException();
}
String fieldType = null;
if(field != null) {
fieldType = getFieldType(field.getFieldAttribute());
}
String result = formatRBNFImpl(this.addr, value, field,
fieldType, null);
buffer.append(result.toCharArray(), 0, result.length());
return buffer;
|
public java.lang.StringBuffer | format(double value, java.lang.StringBuffer buffer, java.text.FieldPosition field)
if(buffer == null) {
throw new NullPointerException();
}
String fieldType = null;
if(field != null) {
fieldType = getFieldType(field.getFieldAttribute());
}
String result = formatRBNFImpl(this.addr, value, field,
fieldType, null);
buffer.append(result.toCharArray(), 0, result.length());
return buffer;
|
private static native java.lang.String | formatRBNFImpl(int addr, long value, java.text.FieldPosition field, java.lang.String fieldType, java.lang.StringBuffer buffer)
|
private static native java.lang.String | formatRBNFImpl(int addr, double value, java.text.FieldPosition field, java.lang.String fieldType, java.lang.StringBuffer buffer)
|
private static java.lang.String | getFieldType(java.text.Format$Field field)
if(field == null) {
return null;
}
if(field.equals(NumberFormat.Field.SIGN)) {
return "sign";
}
if(field.equals(NumberFormat.Field.INTEGER)) {
return "integer";
}
if(field.equals(NumberFormat.Field.FRACTION)) {
return "fraction";
}
if(field.equals(NumberFormat.Field.EXPONENT)) {
return "exponent";
}
if(field.equals(NumberFormat.Field.EXPONENT_SIGN)) {
return "exponent_sign";
}
if(field.equals(NumberFormat.Field.EXPONENT_SYMBOL)) {
return "exponent_symbol";
}
if(field.equals(NumberFormat.Field.CURRENCY)) {
return "currency";
}
if(field.equals(NumberFormat.Field.GROUPING_SEPARATOR)) {
return "grouping_separator";
}
if(field.equals(NumberFormat.Field.DECIMAL_SEPARATOR)) {
return "decimal_separator";
}
if(field.equals(NumberFormat.Field.PERCENT)) {
return "percent";
}
if(field.equals(NumberFormat.Field.PERMILLE)) {
return "permille";
}
return null;
|
public void | open(com.ibm.icu4jni.text.RuleBasedNumberFormat$RBNFType type)Open a new rule based number format of selected type for the
default location
this.addr = openRBNFImpl(type.getType(),
Locale.getDefault().toString());
|
public void | open(com.ibm.icu4jni.text.RuleBasedNumberFormat$RBNFType type, java.util.Locale locale)Open a new rule based number format of selected type for the
given location
String loc = locale.toString();
if (loc == null) {
throw new NullPointerException();
}
this.addr = openRBNFImpl(type.getType(), loc);
|
public void | open(java.lang.String rule)Open a new rule based number format for the
default location. The rule passed to the method has to be of the form
described in the ibm icu documentation for RuleBasedNumberFormat.
if (rule == null) {
throw new NullPointerException();
}
this.addr = openRBNFImpl(rule, Locale.getDefault().toString());
|
public void | open(java.lang.String rule, java.util.Locale locale)Open a new rule based number format for the
given location. The rule passed to the method has to be of the form
described in the ibm icu documentation for RuleBasedNumberFormat.
String loc = locale.toString();
if (loc == null || rule == null) {
throw new NullPointerException();
}
this.addr = openRBNFImpl(rule, locale.toString());
|
private static native int | openRBNFImpl(int type, java.lang.String loc)
|
private static native int | openRBNFImpl(java.lang.String rule, java.lang.String loc)
|
public java.lang.Number | parse(java.lang.String string, java.text.ParsePosition position)
if (string == null || position == null) {
throw new NullPointerException();
}
return parseRBNFImpl(this.addr, string, position, false);
|
public java.lang.Number | parseLenient(java.lang.String string, java.text.ParsePosition position)This method has the same functionality
as {@link #parse(String, ParsePosition)}
But it uses lenient parsing. This means it also accepts strings that
differ from the correct writing (e.g. case or umlaut differences).
if (string == null || position == null) {
throw new NullPointerException();
}
return parseRBNFImpl(this.addr, string, position, true);
|
static native java.lang.Number | parseRBNFImpl(int addr, java.lang.String string, java.text.ParsePosition position, boolean lenient)
|