12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */ 2f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// © 2016 and later: Unicode, Inc. and others. 3f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html#License 42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* 52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 62ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Copyright (C) 2007-2015, International Business Machines Corporation and 72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * others. All Rights Reserved. 82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.text; 112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.FieldPosition; 132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.ParsePosition; 142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Date; 152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.duration.BasicDurationFormat; 172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ULocale; 182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/** 202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This <b>deprecated</b> class implements a formatter over a duration in time 212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * such as "2 days from now" or "3 hours ago". 222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Use MeasureFormat to format periods like "5 days, 3 hours"; 242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * use RelativeDateTimeFormatter to format relative dates like "5 days ago". 252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see MeasureFormat 272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see RelativeDateTimeFormatter 282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 Use MeasureFormat or RelativeDateTimeFormatter instead. 29836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide Only a subset of ICU is exposed in Android 302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller@Deprecated 322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic abstract class DurationFormat extends UFormat { 332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final long serialVersionUID = -2076961954727774282L; 352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Construct a duration format for the specified locale 382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static DurationFormat getInstance(ULocale locale) { 422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return BasicDurationFormat.getInstance(locale); 432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 44f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Subclass interface 482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 49836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller protected DurationFormat() { 532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 54f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Subclass interface 572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 58836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller protected DurationFormat(ULocale locale) { 622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller setLocale(locale,locale); 632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Format an arbitrary object. 672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Defaults to a call to formatDurationFromNow() for either Long or Date objects. 682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param object the object to format. Should be either a Long, Date, or javax.xml.datatype.Duration object. 692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param toAppend the buffer to append to 702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param pos the field position, may contain additional error messages. 712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the toAppend buffer 722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 75f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract StringBuffer format(Object object, StringBuffer toAppend, 772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller FieldPosition pos); 782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * DurationFormat cannot parse, by default. This method will throw an UnsupportedOperationException. 812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 83f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public Object parseObject(String source, ParsePosition pos) { 862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new UnsupportedOperationException(); 872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Formats the duration between now and a target date. 912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This is a convenience method that calls 932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * formatDurationFrom(long, long) using now 942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * as the reference date, and the difference between now and 952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>targetDate.getTime()</code> as the duration. 96f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * 972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param targetDate the ending date 982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the formatted time 992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 1002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract String formatDurationFromNowTo(Date targetDate); 1032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Formats a duration expressed in milliseconds. 1062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 1072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This is a convenience method that calls formatDurationFrom 1082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * using the current system time as the reference date. 109f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * 1102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param duration the duration in milliseconds 1112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the formatted time 1122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 1132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract String formatDurationFromNow(long duration); 1162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Formats a duration expressed in milliseconds from a reference date. 1192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 1202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The reference date allows formatters to use actual durations of 1212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * variable-length periods (like months) if they wish. 1222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 1232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The duration is expressed as the number of milliseconds in the 1242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * past (negative values) or future (positive values) with respect 1252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to a reference date (expressed as milliseconds in epoch). 126f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * 1272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param duration the duration in milliseconds 1282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param referenceDate the date from which to compute the duration 1292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the formatted time 1302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 56 1312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract String formatDurationFrom(long duration, long referenceDate); 1342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller} 135