/// <summary> /// Return the current period formatter. /// </summary> /// /// <returns>the current period formatter</returns> public PeriodFormatter GetPeriodFormatter() { if (formatter == null) { formatter = ps.NewPeriodFormatterFactory().GetFormatter(); } return(formatter); }
public BasicDurationFormat() { this.pfs = null; pfs = IBM.ICU.Impl.Duration.BasicPeriodFormatterService.GetInstance(); formatter = pfs.NewDurationFormatterFactory().GetFormatter(); pformatter = pfs.NewPeriodFormatterFactory() .SetDisplayPastFuture(false).GetFormatter(); }
/// <summary> /// Creates a basic duration formatter with the given formatter, builder, and /// fallback. It's up to the caller to ensure that the locales and timezones /// of these are in sync. /// </summary> /// public BasicDurationFormatter(PeriodFormatter formatter_0, PeriodBuilder builder_1, DateFormatter fallback_2, long fallbackLimit_3) { this.formatter = formatter_0; this.builder = builder_1; this.fallback = fallback_2; this.fallbackLimit = (fallbackLimit_3 < 0) ? (long)(0) : (long)(fallbackLimit_3); }
/// <summary> /// Set the period formatter used by the factory. New formatters created with /// this factory will use the given period formatter. /// </summary> /// /// <param name="builder">the builder to use</param> /// <returns>this BasicDurationFormatterFactory</returns> public virtual DurationFormatterFactory SetPeriodFormatter(PeriodFormatter formatter_0) { if (formatter_0 != this.formatter) { this.formatter = formatter_0; Reset(); } return(this); }
protected internal BasicDurationFormatter(PeriodFormatter formatter_0, PeriodBuilder builder_1, DateFormatter fallback_2, long fallbackLimit_3, String localeName_4, IBM.ICU.Util.TimeZone timeZone_5) { this.formatter = formatter_0; this.builder = builder_1; this.fallback = fallback_2; this.fallbackLimit = fallbackLimit_3; this.localeName = localeName_4; this.timeZone = timeZone_5; }
public virtual DurationFormatter WithLocale(String localeName_0) { if (!localeName_0.Equals(this.localeName)) { PeriodFormatter newFormatter = formatter.WithLocale(localeName_0); PeriodBuilder newBuilder = builder.WithLocale(localeName_0); DateFormatter newFallback = (fallback == null) ? null : fallback .WithLocale(localeName_0); return(new BasicDurationFormatter(newFormatter, newBuilder, newFallback, fallbackLimit, localeName_0, timeZone)); } return(this); }
/// <summary> /// Return a formatter based on this factory's current settings. /// </summary> /// /// <returns>a BasicDurationFormatter</returns> public virtual DurationFormatter GetFormatter() { if (f == null) { if (fallback != null) { fallback = fallback.WithLocale(localeName).WithTimeZone( timeZone); } formatter = GetPeriodFormatter().WithLocale(localeName); builder = GetPeriodBuilder().WithLocale(localeName).WithTimeZone( timeZone); f = CreateFormatter(); } return(f); }