2 ******************************************************************************
\r
3 * Copyright (C) 2007, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 ******************************************************************************
\r
8 package com.ibm.icu.impl.duration;
\r
10 import java.util.TimeZone;
\r
13 * Constructs a Period given a base time and a duration in milliseconds.
\r
15 * PeriodBuilder may be used alone or be set on a DurationFormatter
\r
16 * to customize how that formatter constructs a Period for formatting.
\r
18 * None of the operations on PeriodBuilder change the current builder.
\r
20 public interface PeriodBuilder {
\r
22 * Create a period of the given duration using the current system
\r
23 * time as the reference time.
\r
25 * @param duration the duration in milliseconds from the current time
\r
26 * to the target time. A negative duration indicates a time in the past
\r
27 * @return a Period that represents the duration
\r
29 Period create(long duration);
\r
32 * Create a period of the given duration using the provided reference date.
\r
34 * @param duration the duration in milliseconds from the referenct time
\r
35 * to the target time. A negative duration indicates a time before the
\r
37 * @param referenceDate the reference date from which to compute the period
\r
38 * @return a Period that represents the duration
\r
40 Period createWithReferenceDate(long duration, long referenceDate);
\r
43 * Returns a new PeriodBuilder that uses the provided locale to
\r
44 * determine what periods are available for use.
\r
46 PeriodBuilder withLocale(String localeName);
\r
49 * Returns a new PeriodBuilder that computes periods starting at
\r
50 * dates in the provided time zone.
\r
52 PeriodBuilder withTimeZone(TimeZone tz);
\r