]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/classes/core/src/com/ibm/icu/impl/duration/PeriodBuilder.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / classes / core / src / com / ibm / icu / impl / duration / PeriodBuilder.java
1 /*\r
2 ******************************************************************************\r
3 * Copyright (C) 2007, International Business Machines Corporation and   *\r
4 * others. All Rights Reserved.                                               *\r
5 ******************************************************************************\r
6 */\r
7 \r
8 package com.ibm.icu.impl.duration;\r
9 \r
10 import java.util.TimeZone;\r
11 \r
12 /**\r
13  * Constructs a Period given a base time and a duration in milliseconds.\r
14  * <p>\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
17  * <p>\r
18  * None of the operations on PeriodBuilder change the current builder.\r
19  */\r
20 public interface PeriodBuilder {\r
21   /**\r
22    * Create a period of the given duration using the current system\r
23    * time as the reference time.\r
24    *\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
28    */\r
29   Period create(long duration);\r
30 \r
31   /**\r
32    * Create a period of the given duration using the provided reference date.\r
33    *\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
36    * reference time\r
37    * @param referenceDate the reference date from which to compute the period\r
38    * @return a Period that represents the duration\r
39    */\r
40   Period createWithReferenceDate(long duration, long referenceDate);\r
41 \r
42   /**\r
43    * Returns a new PeriodBuilder that uses the provided locale to \r
44    * determine what periods are available for use.\r
45    */\r
46   PeriodBuilder withLocale(String localeName);\r
47 \r
48   /**\r
49    * Returns a new PeriodBuilder that computes periods starting at\r
50    * dates in the provided time zone.\r
51    */\r
52   PeriodBuilder withTimeZone(TimeZone tz);\r
53 }\r