class FastDateFormat.Rule {
/**
* Returns the estimated lentgh of the result.
*
* @return the estimated length
*/
int estimateLength();
}
class FastDateFormat.CharacterLiteral {
/**
* {@inheritDoc}
*/
public int estimateLength() {
return 1;
}
}
class FastDateFormat.StringLiteral {
public int estimateLength() {
return mValue.length();
}
}
class FastDateFormat.TextField {
public int estimateLength() {
int max = 0;
for (int i=mValues.length; --i >= 0; ) {
int len = mValues[i].length();
if (len > max) {
max = len;
}
}
return max;
}
}
class FastDateFormat.UnpaddedNumberField {
public int estimateLength() {
return 4;
}
}
class FastDateFormat.UnpaddedMonthField {
public int estimateLength() {
return 2;
}
}
class FastDateFormat.PaddedNumberField {
public int estimateLength() {
return 4;
}
}
class FastDateFormat.TwoDigitNumberField {
public int estimateLength() {
return 2;
}
}
class FastDateFormat.TwoDigitYearField {
public int estimateLength() {
return 2;
}
}
class FastDateFormat.TwoDigitMonthField {
public int estimateLength() {
return 2;
}
}
class FastDateFormat.TwelveHourField {
public int estimateLength() {
return mRule.estimateLength();
}
}
class FastDateFormat.TwentyFourHourField {
public int estimateLength() {
return mRule.estimateLength();
}
}
class FastDateFormat.TimeZoneNameRule {
public int estimateLength() {
if (mTimeZoneForced) {
return Math.max(mStandard.length(), mDaylight.length());
} else if (mStyle == TimeZone.SHORT) {
return 4;
} else {
return 40;
}
}
}
class FastDateFormat.TimeZoneNumberRule {
public int estimateLength() {
return 5;
}
}
|