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