Top Description Fields Constructors Methods
com.ibm.icu.impl.duration.impl

public Class PeriodFormatterData

extends Object
Class Inheritance
Imports
java.util.Arrays, com.ibm.icu.impl.duration.TimeUnit, com.ibm.icu.impl.duration.impl.DataRecord.ECountVariant, .DataRecord.EDecimalHandling, .DataRecord.EFractionHandling, .DataRecord.EGender, .DataRecord.EHalfPlacement, .DataRecord.EHalfSupport, .DataRecord.ENumberSystem, .DataRecord.EPluralization, .DataRecord.EUnitVariant, .DataRecord.EZeroHandling, .DataRecord.ScopeData

PeriodFormatterData provides locale-specific data used to format relative dates and times, and convenience api to access it. An instance of PeriodFormatterData is usually created by requesting data for a given locale from an PeriodFormatterDataService.

Field Summary

Modifier and TypeField and Description
pack-priv final DataRecord
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
pack-priv String
public static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if zeros should be allowed
allowZero
()

Return true if zeros are allowed in the display.

public int

Returns:

index to use if might have required or optional suffix, or -1 if none required
appendCount
(TimeUnit
the unit
unit
,
boolean omitCount, boolean useDigitPrefix, int
the count
count
,
int
the format to use for displaying the count
cv
,
boolean
whether to use the count separator, if available
useSep
,
String
the term name
name
,
boolean
true if this is the last unit to be formatted
last
,
StringBuffer
the string builder to which to append the text
sb
)

Append a count to the string builder.

public void
appendCountValue(int
the count
count
,
int
the number of integer digits to display
integralDigits
,
int
the number of decimal digits to display, <= 3
decimalDigits
,
StringBuffer
the string builder to which to append the text
sb
)

Append a count value to the builder.

public void
appendDigits(long
the integer to append
num
,
int
the minimum number of digits to append
mindigits
,
int
the maximum number of digits to append
maxdigits
,
StringBuffer
the string builder to which to append the text
sb
)

Append digits to the string builder, using this.zero for '0' etc.

public void
appendInteger(int num, int mindigits, int maxdigits, StringBuffer sb)

public boolean

Returns:

true if a following digit will require a digit prefix
appendPrefix
(int
how and whether to display the time limit
tl
,
int
how and whether to display the time direction
td
,
StringBuffer
the string builder to which to append the text
sb
)

Append the appropriate prefix to the string builder, depending on whether and how a limit and direction are to be displayed.

public void
appendSkippedUnit(StringBuffer
the string builder to which to append the text
sb
)

Append a marker for skipped units internal to a string.

public void
appendSuffix(int
how and whether to display the time limit
tl
,
int
how and whether to display the time direction
td
,
StringBuffer
the string builder to which to append the text
sb
)

Append the appropriate suffix to the string builder, depending on whether and how a limit and direction are to be displayed.

public boolean

Returns:

true if will require skip marker
appendUnit
(TimeUnit
the unit to append
unit
,
int
the count of units, * 1000
count
,
int
the format to use for displaying the count
cv
,
int
the format to use for displaying the unit
uv
,
boolean
if false, force no separator between count and unit
useCountSep
,
boolean
if true, use the digit prefix
useDigitPrefix
,
boolean
true if there are multiple units in this string
multiple
,
boolean
true if this is the last unit
last
,
boolean
true if the unit(s) before this were skipped
wasSkipped
,
StringBuffer
the string builder to which to append the text
sb
)

Append the count and unit to the string builder.

public boolean

Returns:

true if a prefix will be required before a following unit
appendUnitSeparator
(TimeUnit
the unit to which to append the separator
unit
,
boolean longSep, boolean
true if this is the first unit formatted
afterFirst
,
boolean
true if this is the next-to-last unit to be formatted
beforeLast
,
StringBuffer
the string builder to which to append the text
sb
)

Append the appropriate separator between units

private int
computeForm(TimeUnit unit, int count, int cv, boolean lastOfMultiple)

public int

Returns:

the pluralization format
pluralization
()

Return the pluralization format used by this locale.

public int
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

drback to summary
pack-priv final DataRecord dr
FORM_DUALback to summary
private static final int FORM_DUAL
FORM_HALF_SPELLEDback to summary
private static final int FORM_HALF_SPELLED
FORM_PAUCALback to summary
private static final int FORM_PAUCAL
FORM_PLURALback to summary
private static final int FORM_PLURAL
FORM_SINGULARback to summary
private static final int FORM_SINGULAR
FORM_SINGULAR_NO_OMITback to summary
private static final int FORM_SINGULAR_NO_OMIT
FORM_SINGULAR_SPELLEDback to summary
private static final int FORM_SINGULAR_SPELLED
localeNameback to summary
pack-priv String localeName
traceback to summary
public static boolean trace

Constructor Detail

PeriodFormatterDataback to summary
public PeriodFormatterData(String localeName, DataRecord dr)

Method Detail

allowZeroback to summary
public boolean allowZero()

Return true if zeros are allowed in the display.

Returns:boolean

true if zeros should be allowed

appendCountback to summary
public int appendCount(TimeUnit unit, boolean omitCount, boolean useDigitPrefix, int count, int cv, boolean useSep, String name, boolean last, StringBuffer sb)

Append a count to the string builder.

Parameters
unit:TimeUnit

the unit

count:int

the count

cv:int

the format to use for displaying the count

useSep:boolean

whether to use the count separator, if available

name:String

the term name

last:boolean

true if this is the last unit to be formatted

sb:StringBuffer

the string builder to which to append the text

Returns:int

index to use if might have required or optional suffix, or -1 if none required

appendCountValueback to summary
public void appendCountValue(int count, int integralDigits, int decimalDigits, StringBuffer sb)

Append a count value to the builder.

Parameters
count:int

the count

integralDigits:int

the number of integer digits to display

decimalDigits:int

the number of decimal digits to display, <= 3

sb:StringBuffer

the string builder to which to append the text

appendDigitsback to summary
public void appendDigits(long num, int mindigits, int maxdigits, StringBuffer sb)

Append digits to the string builder, using this.zero for '0' etc.

Parameters
num:long

the integer to append

mindigits:int

the minimum number of digits to append

maxdigits:int

the maximum number of digits to append

sb:StringBuffer

the string builder to which to append the text

appendIntegerback to summary
public void appendInteger(int num, int mindigits, int maxdigits, StringBuffer sb)
appendPrefixback to summary
public boolean appendPrefix(int tl, int td, StringBuffer sb)

Append the appropriate prefix to the string builder, depending on whether and how a limit and direction are to be displayed.

Parameters
tl:int

how and whether to display the time limit

td:int

how and whether to display the time direction

sb:StringBuffer

the string builder to which to append the text

Returns:boolean

true if a following digit will require a digit prefix

appendSkippedUnitback to summary
public void appendSkippedUnit(StringBuffer sb)

Append a marker for skipped units internal to a string.

Parameters
sb:StringBuffer

the string builder to which to append the text

appendSuffixback to summary
public void appendSuffix(int tl, int td, StringBuffer sb)

Append the appropriate suffix to the string builder, depending on whether and how a limit and direction are to be displayed.

Parameters
tl:int

how and whether to display the time limit

td:int

how and whether to display the time direction

sb:StringBuffer

the string builder to which to append the text

appendUnitback to summary
public boolean appendUnit(TimeUnit unit, int count, int cv, int uv, boolean useCountSep, boolean useDigitPrefix, boolean multiple, boolean last, boolean wasSkipped, StringBuffer sb)

Append the count and unit to the string builder.

Parameters
unit:TimeUnit

the unit to append

count:int

the count of units, * 1000

cv:int

the format to use for displaying the count

uv:int

the format to use for displaying the unit

useCountSep:boolean

if false, force no separator between count and unit

useDigitPrefix:boolean

if true, use the digit prefix

multiple:boolean

true if there are multiple units in this string

last:boolean

true if this is the last unit

wasSkipped:boolean

true if the unit(s) before this were skipped

sb:StringBuffer

the string builder to which to append the text

Returns:boolean

true if will require skip marker

Annotations
@SuppressWarnings:fallthrough
appendUnitSeparatorback to summary
public boolean appendUnitSeparator(TimeUnit unit, boolean longSep, boolean afterFirst, boolean beforeLast, StringBuffer sb)

Append the appropriate separator between units

Parameters
unit:TimeUnit

the unit to which to append the separator

afterFirst:boolean

true if this is the first unit formatted

beforeLast:boolean

true if this is the next-to-last unit to be formatted

sb:StringBuffer

the string builder to which to append the text

Returns:boolean

true if a prefix will be required before a following unit

computeFormback to summary
private int computeForm(TimeUnit unit, int count, int cv, boolean lastOfMultiple)
pluralizationback to summary
public int pluralization()

Return the pluralization format used by this locale.

Returns:int

the pluralization format

useMillisecondsback to summary
public int useMilliseconds()
weeksAloneOnlyback to summary
public boolean weeksAloneOnly()