📄 dateformatsymbols.java
字号:
* <li>4 - the short name of the time zone (daylight savings time).</li> * </ul> * * @return The list of time zone display strings. */ public String[] [] getZoneStrings () { return zoneStrings; } /** * This method sets the list of strings used to display AM/PM values to * the specified list. * This is a two element <code>String</code> array indexed by * <code>Calendar.AM</code> and <code>Calendar.PM</code> * * @param value The new list of AM/PM display strings. */ public void setAmPmStrings (String[] value) { ampms = value; } /** * This method sets the list of strings used to display time eras to * to the specified list. * This is a two element <code>String</code> * array indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>. * * @param labels The new list of era display strings. */ public void setEras (String[] labels) { eras = labels; } /** * This method sets the list of characters used to specific date/time * formatting strings. * This is an 18 character string that contains the characters * that are used in creating the date formatting strings in * <code>SimpleDateFormat</code>. The following are the character * positions in the string and which format character they correspond * to (the character in parentheses is the default value in the US English * locale): * <p> * <ul> * <li>0 - era (G)</li> * <li>1 - year (y)</li> * <li>2 - month (M)</li> * <li>3 - day of month (d)</li> * <li>4 - hour out of 12, from 1-12 (h)</li> * <li>5 - hour out of 24, from 0-23 (H)</li> * <li>6 - minute (m)</li> * <li>7 - second (s)</li> * <li>8 - millisecond (S)</li> * <li>9 - date of week (E)</li> * <li>10 - date of year (D)</li> * <li>11 - day of week in month, eg. "4th Thur in Nov" (F)</li> * <li>12 - week in year (w)</li> * <li>13 - week in month (W)</li> * <li>14 - am/pm (a)</li> * <li>15 - hour out of 24, from 1-24 (k)</li> * <li>16 - hour out of 12, from 0-11 (K)</li> * <li>17 - time zone (z)</li> * </ul> * * @param chars The new format pattern characters */ public void setLocalPatternChars (String chars) { localPatternChars = chars; } /** * This method sets the list of strings used to display month names. * This is a thirteen element * string array indexed by <code>Calendar.JANUARY</code> through * <code>Calendar.UNDECEMBER</code>. Note that there are thirteen * elements because some calendars have thriteen months. * * @param labels The list of month display strings. */ public void setMonths (String[] labels) { months = labels; } /** * This method sets the list of strings used to display abbreviated month * names. * This is a thirteen element * <code>String</code> array indexed by <code>Calendar.JANUARY</code> * through <code>Calendar.UNDECEMBER</code>. Note that there are thirteen * elements because some calendars have thirteen months. * * @param labels The new list of abbreviated month display strings. */ public void setShortMonths (String[] labels) { shortMonths = labels; } /** * This method sets the list of strings used to display abbreviated * weekday names. * This is an eight element * <code>String</code> array indexed by <code>Calendar.SUNDAY</code> * through <code>Calendar.SATURDAY</code>. Note that the first element * of this array is ignored. * * @param labels This list of abbreviated weekday display strings. */ public void setShortWeekdays (String[] labels) { shortWeekdays = labels; } /** * This method sets the list of strings used to display weekday names. * This is an eight element * <code>String</code> array indexed by <code>Calendar.SUNDAY</code> * through <code>Calendar.SATURDAY</code>. Note that the first element * of this array is ignored. * * @param labels This list of weekday display strings. */ public void setWeekdays (String[] labels) { weekdays = labels; } /** * This method sets the list of display strings for time zones. * This is a two dimensional <code>String</code> array where each row in * the array contains five values: * <P> * <ul> * <li>0 - The non-localized time zone id string.</li> * <li>1 - The long name of the time zone (standard time).</li> * <li>2 - The short name of the time zone (standard time).</li> * <li>3 - The long name of the time zone (daylight savings time).</li> * <li>4 - the short name of the time zone (daylight savings time).</li> * </ul> * * @params zones The list of time zone display strings. */ public void setZoneStrings (String[][] zones) { zoneStrings = zones; } /* Does a "deep" equality test - recurses into arrays. */ private static boolean equals (Object x, Object y) { if (x == y) return true; if (x == null || y == null) return false; if (! (x instanceof Object[]) || ! (y instanceof Object[])) return x.equals(y); Object[] xa = (Object[]) x; Object[] ya = (Object[]) y; if (xa.length != ya.length) return false; for (int i = xa.length; --i >= 0; ) { if (! equals(xa[i], ya[i])) return false; } return true; } private static int hashCode (Object x) { if (x == null) return 0; if (! (x instanceof Object[])) return x.hashCode(); Object[] xa = (Object[]) x; int hash = 0; for (int i = 0; i < xa.length; i++) hash = 37 * hashCode(xa[i]); return hash; } /** * This method tests a specified object for equality against this object. * This will be true if and only if the specified object: * <p> * <ul> * <li> Is not <code>null</code>.</li> * <li> Is an instance of <code>DateFormatSymbols</code>.</li> * <li> Contains identical formatting symbols to this object.</li> * </ul> * * @param obj The <code>Object</code> to test for equality against. * * @return <code>true</code> if the specified object is equal to this one, * <code>false</code> otherwise. */ public boolean equals (Object obj) { if (! (obj instanceof DateFormatSymbols)) return false; DateFormatSymbols other = (DateFormatSymbols) obj; return (equals(ampms, other.ampms) && equals(eras, other.eras) && equals(localPatternChars, other.localPatternChars) && equals(months, other.months) && equals(shortMonths, other.shortMonths) && equals(shortWeekdays, other.shortWeekdays) && equals(weekdays, other.weekdays) && equals(zoneStrings, other.zoneStrings)); } /** * Returns a new copy of this object. * * @return A copy of this object */ public Object clone () { try { return super.clone (); } catch (CloneNotSupportedException e) { return null; } } /** * This method returns a hash value for this object. * * @return A hash value for this object. */ public int hashCode () { return (hashCode(ampms) ^ hashCode(eras) ^ hashCode(localPatternChars) ^ hashCode(months) ^ hashCode(shortMonths) ^ hashCode(shortWeekdays) ^ hashCode(weekdays) ^ hashCode(zoneStrings)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -