public void Test_getIntegerInstanceLLocale() { // Test for method java.text.NumberFormat // getIntegerInstance(java.util.ILOG.J2CsMapping.Util.Locale) ILOG.J2CsMapping.Util.Locale usLocale = ILOG.J2CsMapping.Util.Locale.US; ILOG.J2CsMapping.Util.Locale arLocale = new ILOG.J2CsMapping.Util.Locale("ar", "AE"); IBM.ICU.Text.DecimalFormat format = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetIntegerInstance(usLocale); NUnit.Framework.Assert.AreEqual("#,##0", format.ToPattern(), "Test1: NumberFormat.getIntegerInstance().toPattern() returned wrong pattern"); NUnit.Framework.Assert.AreEqual("-36", format.Format(-35.76d), "Test2: NumberFormat.getIntegerInstance().format(-35.76) returned wrong value"); NUnit.Framework.Assert.AreEqual((long)(-36), format.Parse("-36"), "Test3: NumberFormat.getIntegerInstance().parse(\"-36\") returned wrong number"); NUnit.Framework.Assert.AreEqual((long)(-36), format.ParseObject("-36"), "Test4: NumberFormat.getIntegerInstance().parseObject(\"-36\") returned wrong number"); NUnit.Framework.Assert.AreEqual(0, format.GetMaximumFractionDigits(), "Test5: NumberFormat.getIntegerInstance().getMaximumFractionDigits() returned wrong value"); NUnit.Framework.Assert.IsTrue(format.IsParseIntegerOnly(), "Test6: NumberFormat.getIntegerInstance().isParseIntegerOnly() returned wrong value"); // try with a ILOG.J2CsMapping.Util.Locale that has a different integer pattern format = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat.GetIntegerInstance(arLocale); NUnit.Framework.Assert.AreEqual("#,##0;#,##0-", format.ToPattern(), "Test7: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).toPattern() returned wrong pattern"); //NUnit.Framework.Assert.AreEqual("36-", format.Format(-6), "Test8: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).format(-35.76) returned wrong value"); NUnit.Framework.Assert.AreEqual((long)(-36), format.Parse("36-"), "Test9: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).parse(\"-36-\") returned wrong number"); NUnit.Framework.Assert.AreEqual((long)(-36), format.ParseObject("36-"), "Test10: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).parseObject(\"36-\") returned wrong number"); NUnit.Framework.Assert.AreEqual(0, format.GetMaximumFractionDigits(), "Test11: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).getMaximumFractionDigits() returned wrong value"); NUnit.Framework.Assert.IsTrue(format.IsParseIntegerOnly(), "Test12: NumberFormat.getIntegerInstance(new ILOG.J2CsMapping.Util.Locale(\"ar\", \"AE\")).isParseIntegerOnly() returned wrong value"); }
internal void ExerciseHoliday(Holiday h, ILOG.J2CsMapping.Util.Locale locale) { Logln("holiday: " + h.GetDisplayName()); Logln("holiday in " + locale + ": " + h.GetDisplayName(locale)); DateTime first = h.FirstAfter(longTimeAgo); Logln("firstAfter: " + longTimeAgo + " is " + first); if (first == null) { first = longTimeAgo; } first = new DateTime(((first.Ticks / 10000) + awhile) * 10000); DateTime second = h.FirstBetween(first, now); Logln("firstBetween: " + first + " and " + now + " is " + second); if (second == null) { second = now; } Logln("is on " + first + ": " + h.IsOn(first)); Logln("is on " + now + ": " + h.IsOn(now)); Logln("is between " + first + " and " + now + ": " + h.IsBetween(first, now)); Logln("is between " + first + " and " + second + ": " + h.IsBetween(first, second)); // logln("rule: " + h.getRule().toString()); // h.setRule(h.getRule()); }
internal void ExerciseHolidays(Holiday[] holidays, ILOG.J2CsMapping.Util.Locale locale) { for (int i = 0; i < holidays.Length; ++i) { ExerciseHoliday(holidays[i], locale); } }
/// <summary> /// Answers a NumberFormat for formatting and parsing percentages for the /// specified Locale. /// </summary> /// /// <param name="locale">the Locale</param> /// <returns>a NumberFormat</returns> public static NumberFormat GetPercentInstance(Locale locale) { IBM.ICU.Text.DecimalFormat icuFormat = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetPercentInstance(locale); String pattern = icuFormat.ToPattern(); return(new DecimalFormat(pattern, new DecimalFormatSymbols(locale))); }
/// <summary> /// Answers a NumberFormat for formatting and parsing integers for the /// specified Locale. /// </summary> /// /// <param name="locale">the Locale</param> /// <returns>a NumberFormat</returns> public static NumberFormat GetIntegerInstance(Locale locale) { IBM.ICU.Text.DecimalFormat icuFormat = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetIntegerInstance(locale); String pattern = icuFormat.ToPattern(); DecimalFormat format = new DecimalFormat(pattern, new DecimalFormatSymbols(locale)); format.SetParseIntegerOnly(true); return(format); }
/// <summary> /// Constructs a new DateFormatSymbols containing the symbols for the /// specified Locale. /// </summary> /// /// <param name="locale">the Locale</param> public DateFormatSymbols(ILOG.J2CsMapping.Util.Locale locale) { IBM.ICU.Text.DateFormatSymbols icuSymbols = new IBM.ICU.Text.DateFormatSymbols( locale); localPatternChars = icuSymbols.GetLocalPatternChars(); ampms = icuSymbols.GetAmPmStrings(); eras = icuSymbols.GetEras(); months = icuSymbols.GetMonths(); shortMonths = icuSymbols.GetShortMonths(); shortWeekdays = icuSymbols.GetShortWeekdays(); weekdays = icuSymbols.GetWeekdays(); zoneStrings = icuSymbols.GetZoneStrings(); }
/// <summary> /// Constructs a new DecimalFormat for formatting and parsing numbers for the /// default Locale. /// </summary> /// public DecimalFormat() { this.parseBigDecimal = false; this.serialVersionOnStream = 3; ILOG.J2CsMapping.Util.Locale locale = ILOG.J2CsMapping.Util.Locale.GetDefault(); icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols(locale); symbols = new DecimalFormatSymbols(locale); dform = new IBM.ICU.Text.DecimalFormat(); base.SetMaximumFractionDigits(dform.GetMaximumFractionDigits()); base.SetMaximumIntegerDigits(dform.GetMaximumIntegerDigits()); base.SetMinimumFractionDigits(dform.GetMinimumFractionDigits()); base.SetMinimumIntegerDigits(dform.GetMinimumIntegerDigits()); }
public void Test_getIntegerInstance() { // Test for method java.text.NumberFormat getIntegerInstance() ILOG.J2CsMapping.Util.Locale origLocale = ILOG.J2CsMapping.Util.Locale.GetDefault(); ILOG.J2CsMapping.Util.Locale.SetDefault(ILOG.J2CsMapping.Util.Locale.US); IBM.ICU.Text.DecimalFormat format = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetIntegerInstance(); NUnit.Framework.Assert.AreEqual("#,##0", format.ToPattern(), "Test1: NumberFormat.getIntegerInstance().toPattern() returned wrong pattern"); NUnit.Framework.Assert.AreEqual("36", format.Format(35.76d), "Test2: NumberFormat.getIntegerInstance().format(35.76) returned wrong value"); NUnit.Framework.Assert.AreEqual((long)(35), format.Parse("35.76"), "Test3: NumberFormat.getIntegerInstance().parse(\"35.76\") returned wrong number"); NUnit.Framework.Assert.AreEqual((long)(35), format.ParseObject("35.76"), "Test4: NumberFormat.getIntegerInstance().parseObject(\"35.76\") returned wrong number"); ILOG.J2CsMapping.Util.Locale.SetDefault(origLocale); }
/// <summary> /// Constructs a new DecimalFormat using the specified non-localized pattern /// and DecimalFormatSymbols. /// </summary> /// /// <param name="pattern">the non-localized pattern</param> /// <param name="value">the DecimalFormatSymbols</param> /// <exception cref="IllegalArgumentException">when the pattern cannot be parsed</exception> public DecimalFormat(String pattern, DecimalFormatSymbols value_ren) { this.parseBigDecimal = false; this.serialVersionOnStream = 3; symbols = (DecimalFormatSymbols)value_ren.Clone(); ILOG.J2CsMapping.Util.Locale locale = symbols.GetLocale(); //$NON-NLS-1$ icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols(locale); CopySymbols(icuSymbols, symbols); dform = new IBM.ICU.Text.DecimalFormat(pattern, icuSymbols); base.SetMaximumFractionDigits(dform.GetMaximumFractionDigits()); base.SetMaximumIntegerDigits(dform.GetMaximumIntegerDigits()); base.SetMinimumFractionDigits(dform.GetMinimumFractionDigits()); base.SetMinimumIntegerDigits(dform.GetMinimumIntegerDigits()); }
/// <summary> /// Convenience method for callers using locales. This returns the standard /// Locale list, built from the Set of visible ids. /// </summary> /// public ILOG.J2CsMapping.Util.Locale[] GetAvailableLocales() { // TODO make this wrap getAvailableULocales later ILOG.J2CsMapping.Collections.ISet visIDs = GetVisibleIDs(); IIterator iter = new ILOG.J2CsMapping.Collections.IteratorAdapter(visIDs.GetEnumerator()); ILOG.J2CsMapping.Util.Locale[] locales = new ILOG.J2CsMapping.Util.Locale[visIDs.Count]; int n = 0; while (iter.HasNext()) { ILOG.J2CsMapping.Util.Locale loc = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName((String)iter.Next()); locales[n++] = loc; } return(locales); }
/// <summary> /// Constructs a new DecimalFormatSymbols containing the symbols for the /// specified Locale. /// </summary> /// /// <param name="locale_0">the Locale</param> public DecimalFormatSymbols(ILOG.J2CsMapping.Util.Locale locale_0) { this.ZeroDigit = 0; this.Digit = 1; this.DecimalSeparator = 2; this.GroupingSeparator = 3; this.PatternSeparator = 4; this.Percent = 5; this.PerMill = 6; this.Exponent = 7; this.MonetaryDecimalSeparator = 8; this.MinusSign = 9; IBM.ICU.Text.DecimalFormatSymbols icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols( locale_0); infinity = icuSymbols.GetInfinity(); NaN = icuSymbols.GetNaN(); this.locale = locale_0; currencySymbol = icuSymbols.GetCurrencySymbol(); intlCurrencySymbol = icuSymbols.GetInternationalCurrencySymbol(); if (locale_0.GetCountry().Length == 0) { currency = Currency.GetInstance("XXX"); } else { currency = Currency.GetInstance(locale_0); } patternChars = new char[10]; patternChars[ZeroDigit] = icuSymbols.GetZeroDigit(); patternChars[Digit] = icuSymbols.GetDigit(); patternChars[DecimalSeparator] = icuSymbols.GetDecimalSeparator(); patternChars[GroupingSeparator] = icuSymbols.GetGroupingSeparator(); patternChars[PatternSeparator] = icuSymbols.GetPatternSeparator(); patternChars[Percent] = icuSymbols.GetPercent(); patternChars[PerMill] = icuSymbols.GetPerMill(); patternChars[Exponent] = icuSymbols.GetExponentSeparator()[0]; patternChars[MonetaryDecimalSeparator] = icuSymbols .GetMonetaryDecimalSeparator(); patternChars[MinusSign] = icuSymbols.GetMinusSign(); }
public void TestDeprecatedCurrencyFormat() { // bug 5952 ILOG.J2CsMapping.Util.Locale locale = new ILOG.J2CsMapping.Util.Locale("sr", "QQ"); DecimalFormatSymbols icuSymbols = new IBM.ICU.Text.DecimalFormatSymbols( locale); String symbol = icuSymbols.GetCurrencySymbol(); Currency currency = icuSymbols.GetCurrency(); String expectCur = null; String expectSym = "\u00A4"; if (!symbol.ToString().Equals(expectSym) || currency != null) { Errln("for " + locale + " expected " + expectSym + "/" + expectCur + " but got " + symbol + "/" + currency); } else { Logln("for " + locale + " expected " + expectSym + "/" + expectCur + " and got " + symbol + "/" + currency); } }
public void TestAPI() { { // getHolidays Holiday[] holidays = IBM.ICU.Util.Holiday.GetHolidays(); ExerciseHolidays(holidays, ILOG.J2CsMapping.Util.Locale.GetDefault()); } { // getHolidays(Locale) String[] localeNames = { "en_US", "da", "da_DK", "de", "de_AT", "de_DE", "el", "el_GR", "en", "en_CA", "en_GB", "es", "es_MX", "fr", "fr_CA", "fr_FR", "it", "it_IT", "iw", "iw_IL", "ja", "ja_JP", }; for (int i = 0; i < localeNames.Length; ++i) { ILOG.J2CsMapping.Util.Locale locale = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName(localeNames[i]); IBM.ICU.Util.Holiday[] holidays_0 = IBM.ICU.Util.Holiday.GetHolidays(locale); ExerciseHolidays(holidays_0, locale); } } }
public void TestCoverage() { { // new EthiopicCalendar(TimeZone) EthiopicCalendar cal = new EthiopicCalendar(IBM.ICU.Util.TimeZone.GetDefault()); if (cal == null) { Errln("could not create EthiopicCalendar with TimeZone"); } } { // new EthiopicCalendar(ULocale) EthiopicCalendar cal_0 = new EthiopicCalendar(IBM.ICU.Util.ULocale.GetDefault()); if (cal_0 == null) { Errln("could not create EthiopicCalendar with ULocale"); } } { // new EthiopicCalendar(Locale) EthiopicCalendar cal_1 = new EthiopicCalendar(ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_1 == null) { Errln("could not create EthiopicCalendar with Locale"); } } { // new EthiopicCalendar(TimeZone, Locale) EthiopicCalendar cal_2 = new EthiopicCalendar(IBM.ICU.Util.TimeZone.GetDefault(), ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_2 == null) { Errln("could not create EthiopicCalendar with TimeZone,Locale"); } } { // new EthiopicCalendar(TimeZone, ULocale) EthiopicCalendar cal_3 = new EthiopicCalendar(IBM.ICU.Util.TimeZone.GetDefault(), IBM.ICU.Util.ULocale.GetDefault()); if (cal_3 == null) { Errln("could not create EthiopicCalendar with TimeZone,ULocale"); } } { // new EthiopicCalendar(Date) EthiopicCalendar cal_4 = new EthiopicCalendar(DateTime.Now); if (cal_4 == null) { Errln("could not create EthiopicCalendar with Date"); } } { // new EthiopicCalendar(int year, int month, int date) EthiopicCalendar cal_5 = new EthiopicCalendar(1997, IBM.ICU.Util.EthiopicCalendar.MESKEREM, 1); if (cal_5 == null) { Errln("could not create EthiopicCalendar with year,month,date"); } } { // new EthiopicCalendar(int year, int month, int date, int hour, int // minute, int second) EthiopicCalendar cal_6 = new EthiopicCalendar(1997, IBM.ICU.Util.EthiopicCalendar.MESKEREM, 1, 1, 1, 1); if (cal_6 == null) { Errln("could not create EthiopicCalendar with year,month,date,hour,minute,second"); } } { // setCivil/isCivil // operations on non-civil calendar EthiopicCalendar cal_7 = NewAmeteAlemEraCalendar(); cal_7.SetAmeteAlemEra(false); if (cal_7.IsAmeteAlemEra()) { Errln("EthiopicCalendar calendar is old system"); } DateTime now = DateTime.Now; cal_7.SetTime(now); DateTime then = cal_7.GetTime(); if (now != then) { Errln("get/set time failed with non-civil EthiopicCalendar calendar"); } Logln(then.ToString()); cal_7.Add(IBM.ICU.Util.Calendar.MONTH, 1); cal_7.Add(IBM.ICU.Util.Calendar.DAY_OF_MONTH, 1); cal_7.Add(IBM.ICU.Util.Calendar.YEAR, 1); Logln(cal_7.GetTime().ToString()); } { // data EthiopicCalendar cal_8 = new EthiopicCalendar(1997, IBM.ICU.Util.EthiopicCalendar.MESKEREM, 1); DateTime time = cal_8.GetTime(); String[] calendarLocales = { "am_ET", "gez_ET", "ti_ET" }; String[] formatLocales = { "en", "am", "gez", "ti" }; for (int i = 0; i < calendarLocales.Length; ++i) { String calLocName = calendarLocales[i]; ILOG.J2CsMapping.Util.Locale calLocale = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName(calLocName); cal_8 = new EthiopicCalendar(calLocale); for (int j = 0; j < formatLocales.Length; ++j) { String locName = formatLocales[j]; ILOG.J2CsMapping.Util.Locale formatLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(locName); DateFormat format = IBM.ICU.Text.DateFormat.GetDateTimeInstance(cal_8, IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, formatLocale); Logln(calLocName + "/" + locName + " --> " + format.Format(time)); } } } }
/// <summary> /// Constructs a <c>CopticCalendar</c> based on the current time in the /// given time zone with the given locale. /// </summary> /// /// <param name="zone">The time zone for the new calendar.</param> /// <param name="aLocale">The locale for the new calendar.</param> /// @stable ICU 3.4 public CopticCalendar(TimeZone zone, ILOG.J2CsMapping.Util.Locale aLocale) : base(zone, aLocale) { jdEpochOffset = JD_EPOCH_OFFSET; }
/// <summary> /// Constructs a <c>CopticCalendar</c> based on the current time in the /// default time zone with the given locale. /// </summary> /// /// <param name="aLocale">The locale for the new calendar.</param> /// @stable ICU 3.4 public CopticCalendar(ILOG.J2CsMapping.Util.Locale aLocale) : base(aLocale) { jdEpochOffset = JD_EPOCH_OFFSET; }
/// <summary> /// Gets a script codes associated with the given locale or ISO 15924 /// abbreviation or name. Returns MALAYAM given "Malayam" OR "Mlym". Returns /// LATIN given "en" OR "en_US" /// </summary> /// /// <param name="locale">Locale</param> /// <returns>The script codes array. null if the the code cannot be found.</returns> /// @stable ICU 2.4 public static int[] GetCode(ILOG.J2CsMapping.Util.Locale locale) { return(FindCodeFromLocale(IBM.ICU.Util.ULocale.ForLocale(locale))); }
/// <summary> /// Constructs a <c>EthiopicCalendar</c> based on the current time in /// the given time zone with the given locale. /// </summary> /// /// <param name="zone">The time zone for the new calendar.</param> /// <param name="aLocale">The locale for the new calendar.</param> /// @stable ICU 3.4 public EthiopicCalendar(TimeZone zone, ILOG.J2CsMapping.Util.Locale aLocale) : base(zone, aLocale) { jdEpochOffset = JD_EPOCH_OFFSET_AMETE_MIHRET; }
/// <summary> /// Constructs a <c>JapaneseCalendar</c> based on the current time in /// the default time zone with the given locale. /// </summary> /// /// <param name="aLocale">the given locale.</param> /// @stable ICU 2.8 public JapaneseCalendar(ILOG.J2CsMapping.Util.Locale aLocale) : base(aLocale) { }
/// <summary> /// Construct a ChineseDateFormatSymbols for the provided calendar and /// locale. /// </summary> /// /// <param name="cal">the Calendar</param> /// <param name="locale">the locale</param> /// @stable ICU 2.0 public ChineseDateFormatSymbols(IBM.ICU.Util.Calendar cal, ILOG.J2CsMapping.Util.Locale locale) : base((cal == null) ? null : ((object)cal).GetType(), locale) { }
public void TestCoverage() { try { { // new HebrewCalendar(TimeZone) IBM.ICU.Util.HebrewCalendar cal = new IBM.ICU.Util.HebrewCalendar(IBM.ICU.Util.TimeZone.GetDefault()); if (cal == null) { Errln("could not create HebrewCalendar with TimeZone"); } } { // new HebrewCalendar(ULocale) IBM.ICU.Util.HebrewCalendar cal_0 = new IBM.ICU.Util.HebrewCalendar(IBM.ICU.Util.ULocale.GetDefault()); if (cal_0 == null) { Errln("could not create HebrewCalendar with ULocale"); } } { // new HebrewCalendar(Locale) IBM.ICU.Util.HebrewCalendar cal_1 = new IBM.ICU.Util.HebrewCalendar(ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_1 == null) { Errln("could not create HebrewCalendar with locale"); } } { // new HebrewCalendar(Date) IBM.ICU.Util.HebrewCalendar cal_2 = new IBM.ICU.Util.HebrewCalendar(DateTime.Now); if (cal_2 == null) { Errln("could not create HebrewCalendar with date"); } } { // data IBM.ICU.Util.HebrewCalendar cal_3 = new IBM.ICU.Util.HebrewCalendar(2800, IBM.ICU.Util.HebrewCalendar.SHEVAT, 1); DateTime time = cal_3.GetTime(); String[] calendarLocales = { "iw_IL" }; String[] formatLocales = { "en", "fi", "fr", "hu", "iw", "nl" }; for (int i = 0; i < calendarLocales.Length; ++i) { String calLocName = calendarLocales[i]; ILOG.J2CsMapping.Util.Locale calLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(calLocName); cal_3 = new IBM.ICU.Util.HebrewCalendar(calLocale); for (int j = 0; j < formatLocales.Length; ++j) { String locName = formatLocales[j]; ILOG.J2CsMapping.Util.Locale formatLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(locName); DateFormat format = IBM.ICU.Text.DateFormat.GetDateTimeInstance(cal_3, IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, formatLocale); Logln(calLocName + "/" + locName + " --> " + format.Format(time)); } } } } catch (MissingManifestResourceException ex) { Warnln("Could not load the locale data. " + ex.Message); } }
/// <summary> /// Constructs a <c>TaiwanCalendar</c> based on the current time in the /// default time zone with the given locale. /// </summary> /// /// <param name="aLocale">the given locale.</param> /// @draft ICU 3.8 /// @provisional This API might change or be removed in a future release. public TaiwanCalendar(ILOG.J2CsMapping.Util.Locale aLocale) : base(aLocale) { }
/// <summary> /// Construct a ChineseDateFormatSymbols for the provided locale. /// </summary> /// /// <param name="locale">the locale</param> /// @stable ICU 2.0 public ChineseDateFormatSymbols(ILOG.J2CsMapping.Util.Locale locale) : base(typeof(ChineseCalendar), IBM.ICU.Util.ULocale.ForLocale(locale)) { }
/// <summary> /// Constructs a <c>TaiwanCalendar</c> based on the current time in the /// given time zone with the given locale. /// </summary> /// /// <param name="zone">the given time zone.</param> /// @draft ICU 3.8 /// @provisional This API might change or be removed in a future release. public TaiwanCalendar(TimeZone zone, ILOG.J2CsMapping.Util.Locale aLocale) : base(zone, aLocale) { }
public void TestCoverage() { { // new JapaneseCalendar(TimeZone) IBM.ICU.Util.JapaneseCalendar cal = new IBM.ICU.Util.JapaneseCalendar(IBM.ICU.Util.TimeZone.GetDefault()); if (cal == null) { Errln("could not create JapaneseCalendar with TimeZone"); } } { // new JapaneseCalendar(ULocale) IBM.ICU.Util.JapaneseCalendar cal_0 = new IBM.ICU.Util.JapaneseCalendar(IBM.ICU.Util.ULocale.GetDefault()); if (cal_0 == null) { Errln("could not create JapaneseCalendar with ULocale"); } } { // new JapaneseCalendar(TimeZone, ULocale) IBM.ICU.Util.JapaneseCalendar cal_1 = new IBM.ICU.Util.JapaneseCalendar(IBM.ICU.Util.TimeZone.GetDefault(), IBM.ICU.Util.ULocale.GetDefault()); if (cal_1 == null) { Errln("could not create JapaneseCalendar with TimeZone ULocale"); } } { // new JapaneseCalendar(Locale) IBM.ICU.Util.JapaneseCalendar cal_2 = new IBM.ICU.Util.JapaneseCalendar(ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_2 == null) { Errln("could not create JapaneseCalendar with Locale"); } } { // new JapaneseCalendar(TimeZone, Locale) IBM.ICU.Util.JapaneseCalendar cal_3 = new IBM.ICU.Util.JapaneseCalendar(IBM.ICU.Util.TimeZone.GetDefault(), ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_3 == null) { Errln("could not create JapaneseCalendar with TimeZone Locale"); } } { // new JapaneseCalendar(Date) IBM.ICU.Util.JapaneseCalendar cal_4 = new IBM.ICU.Util.JapaneseCalendar(DateTime.Now); if (cal_4 == null) { Errln("could not create JapaneseCalendar with Date"); } } { // new JapaneseCalendar(int year, int month, int date) IBM.ICU.Util.JapaneseCalendar cal_5 = new IBM.ICU.Util.JapaneseCalendar(1868, IBM.ICU.Util.Calendar.JANUARY, 1); if (cal_5 == null) { Errln("could not create JapaneseCalendar with year,month,date"); } } { // new JapaneseCalendar(int era, int year, int month, int date) IBM.ICU.Util.JapaneseCalendar cal_6 = new IBM.ICU.Util.JapaneseCalendar(IBM.ICU.Util.JapaneseCalendar.MEIJI, 43, IBM.ICU.Util.Calendar.JANUARY, 1); if (cal_6 == null) { Errln("could not create JapaneseCalendar with era,year,month,date"); } } { // new JapaneseCalendar(int year, int month, int date, int hour, int // minute, int second) IBM.ICU.Util.JapaneseCalendar cal_7 = new IBM.ICU.Util.JapaneseCalendar(1868, IBM.ICU.Util.Calendar.JANUARY, 1, 1, 1, 1); if (cal_7 == null) { Errln("could not create JapaneseCalendar with year,month,date,hour,min,second"); } } { // limits IBM.ICU.Util.JapaneseCalendar cal_8 = new IBM.ICU.Util.JapaneseCalendar(); DateFormat fmt = cal_8.GetDateTimeFormat(IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, new ILOG.J2CsMapping.Util.Locale("en")); cal_8.Set(IBM.ICU.Util.Calendar.ERA, IBM.ICU.Util.JapaneseCalendar.MEIJI); Logln("date: " + cal_8.GetTime()); Logln("min era: " + cal_8.GetMinimum(IBM.ICU.Util.Calendar.ERA)); Logln("min year: " + cal_8.GetMinimum(IBM.ICU.Util.Calendar.YEAR)); cal_8.Set(IBM.ICU.Util.Calendar.YEAR, cal_8.GetActualMaximum(IBM.ICU.Util.Calendar.YEAR)); Logln("date: " + fmt.Format(cal_8.GetTime())); cal_8.Add(IBM.ICU.Util.Calendar.YEAR, 1); Logln("date: " + fmt.Format(cal_8.GetTime())); } { // data IBM.ICU.Util.JapaneseCalendar cal_9 = new IBM.ICU.Util.JapaneseCalendar(1868, IBM.ICU.Util.Calendar.JANUARY, 1); DateTime time = cal_9.GetTime(); String[] calendarLocales = { "en", "ja_JP" }; String[] formatLocales = { "en", "ja" }; for (int i = 0; i < calendarLocales.Length; ++i) { String calLocName = calendarLocales[i]; ILOG.J2CsMapping.Util.Locale calLocale = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName(calLocName); cal_9 = new IBM.ICU.Util.JapaneseCalendar(calLocale); for (int j = 0; j < formatLocales.Length; ++j) { String locName = formatLocales[j]; ILOG.J2CsMapping.Util.Locale formatLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(locName); DateFormat format = IBM.ICU.Text.DateFormat.GetDateTimeInstance(cal_9, IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, formatLocale); Logln(calLocName + "/" + locName + " --> " + format.Format(time)); } } } }
public void TestCoverage() { { // new CopticCalendar(TimeZone) CopticCalendar cal = new CopticCalendar(IBM.ICU.Util.TimeZone.GetDefault()); if (cal == null) { Errln("could not create CopticCalendar with TimeZone"); } } { // new CopticCalendar(ULocale) CopticCalendar cal_0 = new CopticCalendar(IBM.ICU.Util.ULocale.GetDefault()); if (cal_0 == null) { Errln("could not create CopticCalendar with ULocale"); } } { // new CopticCalendar(Locale) CopticCalendar cal_1 = new CopticCalendar(ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_1 == null) { Errln("could not create CopticCalendar with Locale"); } } { // new CopticCalendar(TimeZone, Locale) CopticCalendar cal_2 = new CopticCalendar(IBM.ICU.Util.TimeZone.GetDefault(), ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_2 == null) { Errln("could not create CopticCalendar with TimeZone, Locale"); } } { // new CopticCalendar(TimeZone, ULocale) CopticCalendar cal_3 = new CopticCalendar(IBM.ICU.Util.TimeZone.GetDefault(), IBM.ICU.Util.ULocale.GetDefault()); if (cal_3 == null) { Errln("could not create CopticCalendar with TimeZone, ULocale"); } } { // new CopticCalendar(Date) CopticCalendar cal_4 = new CopticCalendar(DateTime.Now); if (cal_4 == null) { Errln("could not create CopticCalendar with Date"); } } { // new CopticCalendar(int year, int month, int date) CopticCalendar cal_5 = new CopticCalendar(1997, IBM.ICU.Util.CopticCalendar.TOUT, 1); if (cal_5 == null) { Errln("could not create CopticCalendar with year,month,date"); } } { // new CopticCalendar(int year, int month, int date, int hour, int // minute, int second) CopticCalendar cal_6 = new CopticCalendar(1997, IBM.ICU.Util.CopticCalendar.TOUT, 1, 1, 1, 1); if (cal_6 == null) { Errln("could not create CopticCalendar with year,month,date,hour,minute,second"); } } { // data CopticCalendar cal_7 = new CopticCalendar(1997, IBM.ICU.Util.CopticCalendar.TOUT, 1); DateTime time = cal_7.GetTime(); String[] calendarLocales = { "am_ET", "gez_ET", "ti_ET" }; String[] formatLocales = { "en", "am", "am_ET", "gez", "ti" }; for (int i = 0; i < calendarLocales.Length; ++i) { String calLocName = calendarLocales[i]; ILOG.J2CsMapping.Util.Locale calLocale = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName(calLocName); cal_7 = new CopticCalendar(calLocale); for (int j = 0; j < formatLocales.Length; ++j) { String locName = formatLocales[j]; ILOG.J2CsMapping.Util.Locale formatLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(locName); DateFormat format = IBM.ICU.Text.DateFormat.GetDateTimeInstance(cal_7, IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, formatLocale); Logln(calLocName + "/" + locName + " --> " + format.Format(time)); } } } }
public void TestCoverage() { { // new IndianCalendar(TimeZone) IndianCalendar cal = new IndianCalendar(IBM.ICU.Util.TimeZone.GetDefault()); if (cal == null) { Errln("could not create IndianCalendar with TimeZone"); } } { // new IndianCalendar(ULocale) IndianCalendar cal_0 = new IndianCalendar(IBM.ICU.Util.ULocale.GetDefault()); if (cal_0 == null) { Errln("could not create IndianCalendar with ULocale"); } } { // new IndianCalendar(Locale) IndianCalendar cal_1 = new IndianCalendar(ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_1 == null) { Errln("could not create IndianCalendar with Locale"); } } { // new IndianCalendar(TimeZone, Locale) IndianCalendar cal_2 = new IndianCalendar(IBM.ICU.Util.TimeZone.GetDefault(), ILOG.J2CsMapping.Util.Locale.GetDefault()); if (cal_2 == null) { Errln("could not create IndianCalendar with TimeZone, Locale"); } } { // new IndianCalendar(TimeZone, ULocale) IndianCalendar cal_3 = new IndianCalendar(IBM.ICU.Util.TimeZone.GetDefault(), IBM.ICU.Util.ULocale.GetDefault()); if (cal_3 == null) { Errln("could not create IndianCalendar with TimeZone, ULocale"); } } { // new IndianCalendar(Date) IndianCalendar cal_4 = new IndianCalendar(DateTime.Now); if (cal_4 == null) { Errln("could not create IndianCalendar with Date"); } } { // new IndianCalendar(int year, int month, int date) IndianCalendar cal_5 = new IndianCalendar(1917, IBM.ICU.Util.IndianCalendar.CHAITRA, 1); if (cal_5 == null) { Errln("could not create IndianCalendar with year,month,date"); } } { // new IndianCalendar(int year, int month, int date, int hour, int // minute, int second) IndianCalendar cal_6 = new IndianCalendar(1917, IBM.ICU.Util.IndianCalendar.CHAITRA, 1, 1, 1, 1); if (cal_6 == null) { Errln("could not create IndianCalendar with year,month,date,hour,minute,second"); } } { // data IndianCalendar cal_7 = new IndianCalendar(-1039, 9, 21); String[] calendarLocales = { "bn_IN", "gu_IN", "hi_IN", "kn_IN", "ml_IN", "or_IN", "pa_IN", "ta_IN", "te_IN" }; String[] formatLocales = { "en", "fr", "bn", "gu", "hi", "kn", "ml", "or", "pa", "ta", "te" }; for (int i = 0; i < calendarLocales.Length; ++i) { String calLocName = calendarLocales[i]; ILOG.J2CsMapping.Util.Locale calLocale = IBM.ICU.Impl.LocaleUtility.GetLocaleFromName(calLocName); cal_7 = new IndianCalendar(calLocale); for (int j = 0; j < formatLocales.Length; j++) { String locName = formatLocales[j]; ILOG.J2CsMapping.Util.Locale formatLocale = IBM.ICU.Impl.LocaleUtility .GetLocaleFromName(locName); DateFormat format = IBM.ICU.Text.DateFormat.GetDateTimeInstance(cal_7, IBM.ICU.Text.DateFormat.FULL, IBM.ICU.Text.DateFormat.FULL, formatLocale); // logln(calLocName + "/" + locName + " --> " + // format.format(time)); } } } }
/// <summary> /// Constructs a <c>BuddhistCalendar</c> based on the current time in /// the default time zone with the given locale. /// </summary> /// /// <param name="aLocale">the given locale.</param> /// @stable ICU 2.8 public BuddhistCalendar(ILOG.J2CsMapping.Util.Locale aLocale) : base(aLocale) { }
/// <summary> /// Constructs a <c>BuddhistCalendar</c> based on the current time in /// the given time zone with the given locale. /// </summary> /// /// <param name="zone">the given time zone.</param> /// <param name="aLocale">the given locale.</param> /// @stable ICU 2.8 public BuddhistCalendar(TimeZone zone, ILOG.J2CsMapping.Util.Locale aLocale) : base(zone, aLocale) { }
/// <summary> /// Constructs a <c>JapaneseCalendar</c> based on the current time in /// the given time zone with the given locale. /// </summary> /// /// <param name="zone">the given time zone.</param> /// <param name="aLocale">the given locale.</param> /// @stable ICU 2.8 public JapaneseCalendar(TimeZone zone, ILOG.J2CsMapping.Util.Locale aLocale) : base(zone, aLocale) { }