Home | History | Annotate | Download | only in duration
      1 /* GENERATED SOURCE. DO NOT MODIFY. */
      2 //  2016 and later: Unicode, Inc. and others.
      3 // License & terms of use: http://www.unicode.org/copyright.html#License
      4 /*
      5 ******************************************************************************
      6 * Copyright (C) 2007, International Business Machines Corporation and   *
      7 * others. All Rights Reserved.                                               *
      8 ******************************************************************************
      9 */
     10 
     11 package android.icu.impl.duration;
     12 
     13 import java.util.TimeZone;
     14 
     15 /**
     16  * Constructs a Period given a base time and a duration in milliseconds.
     17  * <p>
     18  * PeriodBuilder may be used alone or be set on a DurationFormatter
     19  * to customize how that formatter constructs a Period for formatting.
     20  * <p>
     21  * None of the operations on PeriodBuilder change the current builder.
     22  * @hide Only a subset of ICU is exposed in Android
     23  */
     24 public interface PeriodBuilder {
     25   /**
     26    * Create a period of the given duration using the current system
     27    * time as the reference time.
     28    *
     29    * @param duration the duration in milliseconds from the current time
     30    * to the target time.  A negative duration indicates a time in the past
     31    * @return a Period that represents the duration
     32    */
     33   Period create(long duration);
     34 
     35   /**
     36    * Create a period of the given duration using the provided reference date.
     37    *
     38    * @param duration the duration in milliseconds from the referenct time
     39    * to the target time.  A negative duration indicates a time before the
     40    * reference time
     41    * @param referenceDate the reference date from which to compute the period
     42    * @return a Period that represents the duration
     43    */
     44   Period createWithReferenceDate(long duration, long referenceDate);
     45 
     46   /**
     47    * Returns a new PeriodBuilder that uses the provided locale to
     48    * determine what periods are available for use.
     49    */
     50   PeriodBuilder withLocale(String localeName);
     51 
     52   /**
     53    * Returns a new PeriodBuilder that computes periods starting at
     54    * dates in the provided time zone.
     55    */
     56   PeriodBuilder withTimeZone(TimeZone tz);
     57 }
     58