1/* GENERATED SOURCE. DO NOT MODIFY. */ 2/* 3 ****************************************************************************** 4 * Copyright (C) 2007-2010, International Business Machines Corporation and * 5 * others. All Rights Reserved. * 6 ****************************************************************************** 7 */ 8 9package android.icu.impl.duration; 10 11import java.util.Collection; 12 13import android.icu.impl.duration.impl.PeriodFormatterDataService; 14import android.icu.impl.duration.impl.ResourceBasedPeriodFormatterDataService; 15 16/** 17 * An implementation of PeriodFormatterService that constructs a 18 * BasicPeriodFormatterFactory. 19 * @hide Only a subset of ICU is exposed in Android 20 */ 21public class BasicPeriodFormatterService implements PeriodFormatterService { 22 private static BasicPeriodFormatterService instance; 23 private PeriodFormatterDataService ds; 24 25 /** 26 * Return the default service instance. This uses the default data service. 27 * 28 * @return an BasicPeriodFormatterService 29 */ 30 public static BasicPeriodFormatterService getInstance() { 31 if (instance == null) { 32 PeriodFormatterDataService ds = ResourceBasedPeriodFormatterDataService 33 .getInstance(); 34 instance = new BasicPeriodFormatterService(ds); 35 } 36 return instance; 37 } 38 39 /** 40 * Construct a BasicPeriodFormatterService using the given 41 * PeriodFormatterDataService. 42 * 43 * @param ds the data service to use 44 */ 45 public BasicPeriodFormatterService(PeriodFormatterDataService ds) { 46 this.ds = ds; 47 } 48 49 public DurationFormatterFactory newDurationFormatterFactory() { 50 return new BasicDurationFormatterFactory(this); 51 } 52 53 public PeriodFormatterFactory newPeriodFormatterFactory() { 54 return new BasicPeriodFormatterFactory(ds); 55 } 56 57 public PeriodBuilderFactory newPeriodBuilderFactory() { 58 return new BasicPeriodBuilderFactory(ds); 59 } 60 61 public Collection<String> getAvailableLocaleNames() { 62 return ds.getAvailableLocales(); 63 } 64} 65