/// <summary> /// Sets the DateFormatSymbols used by this SimpleDateFormat. /// </summary> /// /// <param name="value">the DateFormatSymbols</param> public void SetDateFormatSymbols(DateFormatSymbols value_ren) { IBM.ICU.Text.DateFormatSymbols icuSymbols = new IBM.ICU.Text.DateFormatSymbols(); CopySymbols(value_ren, icuSymbols); icuFormat.SetDateFormatSymbols(icuSymbols); formatData = (DateFormatSymbols)value_ren.Clone(); }
/// <summary> /// Constructs a new SimpleDateFormat for formatting and parsing dates and /// times in the SHORT style for the default Locale. /// </summary> /// public SimpleDateFormat() : this(Locale.GetDefault()) { icuFormat = new IBM.ICU.Text.SimpleDateFormat(); pattern = (String)ILOG.J2CsMapping.Formatting.Format.GetInternalField("pattern", icuFormat); formatData = new DateFormatSymbols(Locale.GetDefault()); }
internal SimpleDateFormat(Locale locale, IBM.ICU.Text.SimpleDateFormat icuFormat_0) : this(locale) { this.icuFormat = icuFormat_0; pattern = (String)ILOG.J2CsMapping.Formatting.Format.GetInternalField("pattern", icuFormat_0); formatData = new DateFormatSymbols(locale); }
/// <summary> /// Constructs a new SimpleDateFormat using the specified non-localized /// pattern and the DateFormatSymbols and Calendar for the specified Locale. /// </summary> /// /// <param name="template">the pattern</param> /// <param name="locale">the Locale</param> /// <exception cref="NullPointerException">if the pattern is null</exception> /// <exception cref="IllegalArgumentException">if the pattern is invalid</exception> public SimpleDateFormat(String template, Locale locale) : this(locale) { ValidatePattern(template); icuFormat = new IBM.ICU.Text.SimpleDateFormat(template, locale); pattern = template; formatData = new DateFormatSymbols(locale); }
/// <summary> /// Constructs a new SimpleDateFormat using the specified non-localized /// pattern and DateFormatSymbols and the Calendar for the default Locale. /// </summary> /// /// <param name="template">the pattern</param> /// <param name="value">the DateFormatSymbols</param> /// <exception cref="NullPointerException">if the pattern is null</exception> /// <exception cref="IllegalArgumentException">if the pattern is invalid</exception> public SimpleDateFormat(String template, DateFormatSymbols value_ren) : this(Locale.GetDefault()) { ValidatePattern(template); icuFormat = new IBM.ICU.Text.SimpleDateFormat(template, Locale.GetDefault()); pattern = template; formatData = (DateFormatSymbols)value_ren.Clone(); }
private void CopySymbols(DateFormatSymbols value_ren, IBM.ICU.Text.DateFormatSymbols icuSymbols) { icuSymbols.SetAmPmStrings(value_ren.GetAmPmStrings()); icuSymbols.SetEras(value_ren.GetEras()); icuSymbols.SetLocalPatternChars(value_ren.GetLocalPatternChars()); icuSymbols.SetMonths(value_ren.GetMonths()); icuSymbols.SetShortMonths(value_ren.GetShortMonths()); icuSymbols.SetShortWeekdays(value_ren.GetShortWeekdays()); icuSymbols.SetWeekdays(value_ren.GetWeekdays()); icuSymbols.SetZoneStrings(value_ren.GetZoneStrings()); }
/// <summary> /// Answers a new DateFormatSymbols with the same symbols as this /// DateFormatSymbols. /// </summary> /// /// <returns>a shallow copy of this DateFormatSymbols</returns> /// <seealso cref="T:System.ICloneable"/> public virtual Object Clone() { try { DateFormatSymbols symbols = (DateFormatSymbols)base.MemberwiseClone(); symbols.ampms = (String[])ampms.Clone(); symbols.eras = (string[])eras.Clone(); symbols.months = (string[])months.Clone(); symbols.shortMonths = (string[])shortMonths.Clone(); symbols.shortWeekdays = (string[])shortWeekdays.Clone(); symbols.weekdays = (string[])weekdays.Clone(); symbols.zoneStrings = new String[zoneStrings.Length][]; for (int i = 0; i < zoneStrings.Length; i++) { symbols.zoneStrings[i] = (string[])zoneStrings[i].Clone(); } return(symbols); } catch (Exception e) { return(null); } }
/// <summary> /// Compares the specified object to this DateFormatSymbols and answer if /// they are equal. The object must be an instance of DateFormatSymbols with /// the same symbols. /// </summary> /// /// <param name="object">the object to compare with this object</param> /// <returns>true if the specified object is equal to this DateFormatSymbols, /// false otherwise</returns> /// <seealso cref="M:ILOG.J2CsMapping.Text2.DateFormatSymbols.HashCode"/> public override bool Equals(Object obj0) { if ((Object)this == obj0) { return(true); } if (!(obj0 is DateFormatSymbols)) { return(false); } DateFormatSymbols obj = (DateFormatSymbols)obj0; if (!localPatternChars.Equals(obj.localPatternChars)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(ampms, obj.ampms)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(eras, obj.eras)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(months, obj.months)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(shortMonths, obj.shortMonths)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(shortWeekdays, obj.shortWeekdays)) { return(false); } if (!ILOG.J2CsMapping.Collections.Arrays.Equals(weekdays, obj.weekdays)) { return(false); } if (zoneStrings.Length != obj.zoneStrings.Length) { return(false); } /* foreach */ foreach (String[] element in zoneStrings) { if (element.Length != element.Length) { return(false); } for (int j = 0; j < element.Length; j++) { if (element[j] != element[j] && !(element[j].Equals(element[j]))) { return(false); } } } return(true); }