public class RomanNumeralFormat extends NumberFormat
NumberFormat.Field| Modifier and Type | Field and Description |
|---|---|
static String |
CHECK_REGEXP
expression for checking roman numeral.
|
protected static LinkedHashMap<String,Integer> |
m_RomanNumerals
the hashmap for the numerals.
|
FRACTION_FIELD, INTEGER_FIELD| Constructor and Description |
|---|
RomanNumeralFormat() |
| Modifier and Type | Method and Description |
|---|---|
StringBuffer |
format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
Specialization of format.
|
StringBuffer |
format(long number,
StringBuffer toAppendTo,
FieldPosition pos)
Specialization of format.
|
boolean |
isGroupingUsed()
Returns whether grouping is used.
|
boolean |
isParseIntegerOnly()
Returns whether numbers are parsed as integers.
|
Number |
parse(String source,
ParsePosition parsePosition)
Returns a Long if possible (e.g., within the range [Long.MIN_VALUE,
Long.MAX_VALUE] and with no decimals), otherwise a Double.
|
protected int |
processDecimal(int decimal,
int lastNumber,
int lastDecimal)
Adds/subtracts the decimal from the lastDecimal based on lastNumber.
|
protected String |
repeatFormat(String s,
int n)
Repeats the format string a number of times.
|
clone, equals, format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingModeformat, formatToCharacterIterator, parseObjectpublic static final String CHECK_REGEXP
protected static LinkedHashMap<String,Integer> m_RomanNumerals
public boolean isGroupingUsed()
isGroupingUsed in class NumberFormatpublic boolean isParseIntegerOnly()
isParseIntegerOnly in class NumberFormatpublic StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
format in class NumberFormatnumber - the double number to formattoAppendTo - the StringBuffer to which the formatted text is to be
appendedpos - the field positionArithmeticException - if rounding is needed with rounding
mode being set to RoundingMode.UNNECESSARYFormat.format(java.lang.Object)protected String repeatFormat(String s, int n)
s - the format to repeatn - the number of times to repeatpublic StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
format in class NumberFormatnumber - the long number to formattoAppendTo - the StringBuffer to which the formatted text is to be
appendedpos - the field positionArithmeticException - if rounding is needed with rounding
mode being set to RoundingMode.UNNECESSARYFormat.format(java.lang.Object)protected int processDecimal(int decimal,
int lastNumber,
int lastDecimal)
decimal - the decimal to add/subtractlastNumber - the last number encounteredlastDecimal - the tally so farpublic Number parse(String source, ParsePosition parsePosition)
parse in class NumberFormatsource - the String to parseparsePosition - the parse positionNumberFormat.isParseIntegerOnly(),
Format.parseObject(java.lang.String, java.text.ParsePosition)Copyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.