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

pack-priv Class BasicPeriodBuilderFactory

Additional top-level classes in compilation unit: PeriodBuilderImpl, FixedUnitBuilder, SingleUnitBuilder, OneOrTwoUnitBuilder, MultiUnitBuilder.

extends Object
implements PeriodBuilderFactory
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.duration.PeriodBuilderFactory
Imports
java.util.TimeZone, com.ibm.icu.impl.duration.impl.DataRecord, .PeriodFormatterData, .PeriodFormatterDataService

Default implementation of PeriodBuilderFactory. This creates builders that use approximate durations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final short
private PeriodFormatterDataService
private BasicPeriodBuilderFactory.Settings

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static long
public PeriodBuilder

Returns:

a builder
getFixedUnitBuilder
(TimeUnit
the single TimeUnit with which to represent times
unit
)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getFixedUnitBuilder.

Return a builder that represents relative time in terms of the single given TimeUnit
public PeriodBuilder

Returns:

a builder
getMultiUnitBuilder
(int periodCount)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getMultiUnitBuilder.

Return a builder that formats the given number of periods, starting with the largest period less than or equal to the duration.
public PeriodBuilder

Returns:

a builder
getOneOrTwoUnitBuilder
()

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getOneOrTwoUnitBuilder.

Return a builder that formats the largest one or two periods, Starting with the largest period less than or equal to the duration.
private BasicPeriodBuilderFactory.Settings
public PeriodBuilder

Returns:

a builder
getSingleUnitBuilder
()

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getSingleUnitBuilder.

Return a builder that represents relative time in terms of the largest period less than or equal to the duration.
public PeriodBuilderFactory
setAllowMilliseconds(boolean
whether milliseconds should be allowed.
allow
)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowMilliseconds.

Sets whether milliseconds are allowed.
public PeriodBuilderFactory
setAllowZero(boolean allow)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowZero.

Sets whether units with a value of zero are represented in a period when 'gaps' appear between time units, e.g. '2 hours, 0 minutes, and 33 seconds'.
public PeriodBuilderFactory
setAvailableUnitRange(TimeUnit
the smallest time unit available for use
minUnit
,
TimeUnit
the largest time unit available for use
maxUnit
)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAvailableUnitRange.

Sets the time units available for use.
public PeriodBuilderFactory
setLocale(String localeName)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setLocale.

Sets the locale for the factory.
public PeriodBuilderFactory
setMaxLimit(float maxLimit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setMaxLimit.

Sets the maximum value for the largest available time unit (as set in setUnits).
public PeriodBuilderFactory
setMinLimit(float minLimit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setMinLimit.

Sets the minimum value for the smallest available time unit (as set in setUnits).
public PeriodBuilderFactory
setTimeZone(TimeZone
the timeZone
timeZone
)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setTimeZone.

Sets the time zone for the factory.
public PeriodBuilderFactory
setUnitIsAvailable(TimeUnit
the time unit
unit
,
boolean
true if the unit is available for use
available
)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setUnitIsAvailable.

Sets whether the time unit is available for use.
public PeriodBuilderFactory
setWeeksAloneOnly(boolean aloneOnly)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setWeeksAloneOnly.

Sets whether weeks are used with other units, or only when weeks are the only unit.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allBitsback to summary
private static final short allBits
dsback to summary
private PeriodFormatterDataService ds
settingsback to summary
private BasicPeriodBuilderFactory.Settings settings

Constructor Detail

BasicPeriodBuilderFactoryback to summary
pack-priv BasicPeriodBuilderFactory(PeriodFormatterDataService ds)

Method Detail

approximateDurationOfback to summary
pack-priv static long approximateDurationOf(TimeUnit unit)
getFixedUnitBuilderback to summary
public PeriodBuilder getFixedUnitBuilder(TimeUnit unit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getFixedUnitBuilder.

Return a builder that represents relative time in terms of the single given TimeUnit

Parameters
unit:TimeUnit

the single TimeUnit with which to represent times

Returns:PeriodBuilder

a builder

Annotations
@Override
getMultiUnitBuilderback to summary
public PeriodBuilder getMultiUnitBuilder(int periodCount)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getMultiUnitBuilder.

Return a builder that formats the given number of periods, starting with the largest period less than or equal to the duration.

Returns:PeriodBuilder

a builder

Annotations
@Override
getOneOrTwoUnitBuilderback to summary
public PeriodBuilder getOneOrTwoUnitBuilder()

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getOneOrTwoUnitBuilder.

Return a builder that formats the largest one or two periods, Starting with the largest period less than or equal to the duration. It formats two periods if the first period has a count < 2 and the next period has a count >= 1.

Returns:PeriodBuilder

a builder

Annotations
@Override
getSettingsback to summary
private BasicPeriodBuilderFactory.Settings getSettings()
getSingleUnitBuilderback to summary
public PeriodBuilder getSingleUnitBuilder()

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.getSingleUnitBuilder.

Return a builder that represents relative time in terms of the largest period less than or equal to the duration.

Returns:PeriodBuilder

a builder

Annotations
@Override
setAllowMillisecondsback to summary
public PeriodBuilderFactory setAllowMilliseconds(boolean allow)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowMilliseconds.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowMilliseconds.

Sets whether milliseconds are allowed. This is only examined when milliseconds are an available field. The default is to allow milliseconds to display normally.

This is intended to be used to set locale-specific behavior. Typically clients will not call this API and instead call setLocale.

Parameters
allow:boolean

whether milliseconds should be allowed.

Returns:PeriodBuilderFactory

a builder

Annotations
@Override
setAllowZeroback to summary
public PeriodBuilderFactory setAllowZero(boolean allow)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowZero.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setAllowZero.

Sets whether units with a value of zero are represented in a period when 'gaps' appear between time units, e.g. '2 hours, 0 minutes, and 33 seconds'. Default is to not represent these explicitly ('2 hours and 33 seconds').

Annotations
@Override
setAvailableUnitRangeback to summary
public PeriodBuilderFactory setAvailableUnitRange(TimeUnit minUnit, TimeUnit maxUnit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setAvailableUnitRange.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setAvailableUnitRange.

Sets the time units available for use. Default is all units.

Parameters
minUnit:TimeUnit

the smallest time unit available for use

maxUnit:TimeUnit

the largest time unit available for use

Returns:PeriodBuilderFactory

this factory

Annotations
@Override
setLocaleback to summary
public PeriodBuilderFactory setLocale(String localeName)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setLocale.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setLocale.

Sets the locale for the factory. Setting the locale can adjust the values for some or all of the other properties to reflect language or cultural conventions. Default is to use the default locale.

Annotations
@Override
setMaxLimitback to summary
public PeriodBuilderFactory setMaxLimit(float maxLimit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setMaxLimit.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setMaxLimit.

Sets the maximum value for the largest available time unit (as set in setUnits). Periods that represent a longer duration than this will be pinned to this value of that time unit and return true for 'isMoreThan'. Default is no limit. Setting a value of zero restores the default.

Annotations
@Override
setMinLimitback to summary
public PeriodBuilderFactory setMinLimit(float minLimit)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setMinLimit.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setMinLimit.

Sets the minimum value for the smallest available time unit (as set in setUnits). Periods that represent a shorter duration than this will be pinned to this value of that time unit and return true for 'isLessThan'. Default is no limit. Setting a value of zero restores the default.

Annotations
@Override
setTimeZoneback to summary
public PeriodBuilderFactory setTimeZone(TimeZone timeZone)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setTimeZone.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setTimeZone.

Sets the time zone for the factory. This can affect the timezone used for date computations.

Parameters
timeZone:TimeZone

the timeZone

Returns:PeriodBuilderFactory

a builder

Annotations
@Override
setUnitIsAvailableback to summary
public PeriodBuilderFactory setUnitIsAvailable(TimeUnit unit, boolean available)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setUnitIsAvailable.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setUnitIsAvailable.

Sets whether the time unit is available for use.

Parameters
unit:TimeUnit

the time unit

available:boolean

true if the unit is available for use

Returns:PeriodBuilderFactory

this factory

Annotations
@Override
setWeeksAloneOnlyback to summary
public PeriodBuilderFactory setWeeksAloneOnly(boolean aloneOnly)

Implements com.ibm.icu.impl.duration.PeriodBuilderFactory.setWeeksAloneOnly.

Doc from com.ibm.icu.impl.duration.PeriodBuilderFactory.setWeeksAloneOnly.

Sets whether weeks are used with other units, or only when weeks are the only unit. For example '3 weeks and 2 days' versus '23 days'. Default is to use them alone only.

Annotations
@Override
com.ibm.icu.impl.duration back to summary

pack-priv Class BasicPeriodBuilderFactory.Settings

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv int
pack-priv TimeUnit
pack-priv int
pack-priv TimeUnit
pack-priv short
pack-priv boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public BasicPeriodBuilderFactory.Settings
copy()

pack-priv Period
createLimited(long duration, boolean inPast)

pack-priv TimeUnit
pack-priv short
pack-priv BasicPeriodBuilderFactory.Settings
setAllowMilliseconds(boolean allowMillis)

pack-priv BasicPeriodBuilderFactory.Settings
setAllowZero(boolean allow)

pack-priv BasicPeriodBuilderFactory.Settings
pack-priv BasicPeriodBuilderFactory.Settings
setLocale(String localeName)

pack-priv BasicPeriodBuilderFactory.Settings
setMaxLimit(float maxLimit)

pack-priv BasicPeriodBuilderFactory.Settings
setMinLimit(float minLimit)

pack-priv BasicPeriodBuilderFactory.Settings
setUnits(int uset)

pack-priv BasicPeriodBuilderFactory.Settings
setWeeksAloneOnly(boolean weeksAlone)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allowMillisback to summary
pack-priv boolean allowMillis
allowZeroback to summary
pack-priv boolean allowZero
inUseback to summary
pack-priv boolean inUse
maxLimitback to summary
pack-priv int maxLimit
maxUnitback to summary
pack-priv TimeUnit maxUnit
minLimitback to summary
pack-priv int minLimit
minUnitback to summary
pack-priv TimeUnit minUnit
usetback to summary
pack-priv short uset
weeksAloneOnlyback to summary
pack-priv boolean weeksAloneOnly

Constructor Detail

Settingsback to summary
pack-priv Settings()

Method Detail

copyback to summary
public BasicPeriodBuilderFactory.Settings copy()
createLimitedback to summary
pack-priv Period createLimited(long duration, boolean inPast)
effectiveMinUnitback to summary
pack-priv TimeUnit effectiveMinUnit()
effectiveSetback to summary
pack-priv short effectiveSet()
setAllowMillisecondsback to summary
pack-priv BasicPeriodBuilderFactory.Settings setAllowMilliseconds(boolean allowMillis)
setAllowZeroback to summary
pack-priv BasicPeriodBuilderFactory.Settings setAllowZero(boolean allow)
setInUseback to summary
pack-priv BasicPeriodBuilderFactory.Settings setInUse()
setLocaleback to summary
pack-priv BasicPeriodBuilderFactory.Settings setLocale(String localeName)
setMaxLimitback to summary
pack-priv BasicPeriodBuilderFactory.Settings setMaxLimit(float maxLimit)
setMinLimitback to summary
pack-priv BasicPeriodBuilderFactory.Settings setMinLimit(float minLimit)
setUnitsback to summary
pack-priv BasicPeriodBuilderFactory.Settings setUnits(int uset)
setWeeksAloneOnlyback to summary
pack-priv BasicPeriodBuilderFactory.Settings setWeeksAloneOnly(boolean weeksAlone)