~ubuntu-branches/ubuntu/vivid/icu4j-4.4/vivid

« back to all changes in this revision

Viewing changes to main/classes/core/src/com/ibm/icu/impl/duration/PeriodBuilder.java

  • Committer: Bazaar Package Importer
  • Author(s): Niels Thykier
  • Date: 2011-08-02 15:50:33 UTC
  • Revision ID: james.westby@ubuntu.com-20110802155033-itjzsl21y2lqdonn
Tags: upstream-4.4.2
ImportĀ upstreamĀ versionĀ 4.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
******************************************************************************
 
3
* Copyright (C) 2007, International Business Machines Corporation and   *
 
4
* others. All Rights Reserved.                                               *
 
5
******************************************************************************
 
6
*/
 
7
 
 
8
package com.ibm.icu.impl.duration;
 
9
 
 
10
import java.util.TimeZone;
 
11
 
 
12
/**
 
13
 * Constructs a Period given a base time and a duration in milliseconds.
 
14
 * <p>
 
15
 * PeriodBuilder may be used alone or be set on a DurationFormatter
 
16
 * to customize how that formatter constructs a Period for formatting.
 
17
 * <p>
 
18
 * None of the operations on PeriodBuilder change the current builder.
 
19
 */
 
20
public interface PeriodBuilder {
 
21
  /**
 
22
   * Create a period of the given duration using the current system
 
23
   * time as the reference time.
 
24
   *
 
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
 
28
   */
 
29
  Period create(long duration);
 
30
 
 
31
  /**
 
32
   * Create a period of the given duration using the provided reference date.
 
33
   *
 
34
   * @param duration the duration in milliseconds from the referenct time
 
35
   * to the target time.  A negative duration indicates a time before the
 
36
   * reference time
 
37
   * @param referenceDate the reference date from which to compute the period
 
38
   * @return a Period that represents the duration
 
39
   */
 
40
  Period createWithReferenceDate(long duration, long referenceDate);
 
41
 
 
42
  /**
 
43
   * Returns a new PeriodBuilder that uses the provided locale to 
 
44
   * determine what periods are available for use.
 
45
   */
 
46
  PeriodBuilder withLocale(String localeName);
 
47
 
 
48
  /**
 
49
   * Returns a new PeriodBuilder that computes periods starting at
 
50
   * dates in the provided time zone.
 
51
   */
 
52
  PeriodBuilder withTimeZone(TimeZone tz);
 
53
}