*/
public CharSequence format(List numbers, int groupSize, String groupSeparator,
String letterValue, String ordinal, Numberer numberer) {
FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.TINY);
int num = 0;
int tok = 0;
// output first punctuation token
if (startsWithPunctuation) {
sb.append((String)punctuationTokens.get(tok));
}
// output the list of numbers
while (num<numbers.size()) {
if (num>0) {
if (tok==0 && startsWithPunctuation) {
// The first punctuation token isn't a separator if it appears before the first
// formatting token. Such a punctuation token is used only once, at the start.
sb.append(".");
} else {
sb.append((String)punctuationTokens.get(tok));
}
}
Object o = numbers.get(num++);
String s;
if (o instanceof Long) {
long nr = ((Long)o).longValue();
RegularGroupFormatter rgf = new RegularGroupFormatter(groupSize, groupSeparator);
s = numberer.format(nr, (String)formatTokens.get(tok), rgf, letterValue, ordinal);
} else if (o instanceof BigDecimal) {
s = new IntegerValue((BigDecimal)o).getStringValue();
} else {
s = o.toString();
}
sb.append(s);
tok++;
if (tok==formatTokens.size()) tok--;
}
// output the final punctuation token
if (punctuationTokens.size()>formatTokens.size()) {
sb.append((String)punctuationTokens.get(punctuationTokens.size()-1));
}
return sb.condense();
}