Skip to content

Commit 82d5509

Browse files
authored
Merge pull request #219 from BobHanson/hanson1
Hanson1
2 parents f9a4db2 + e054278 commit 82d5509

File tree

16 files changed

+2229
-1140
lines changed

16 files changed

+2229
-1140
lines changed
55.7 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20210720070346
1+
20210720163506
55.7 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20210720070346
1+
20210720163506
572 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/text/DateFormatSymbols.java

Lines changed: 90 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import java.util.Locale;
4747
import java.util.ResourceBundle;
4848

49+
import sun.util.TimeZoneNameUtility;
4950
import sun.util.resources.LocaleData;
5051

5152
/**
@@ -409,47 +410,47 @@ public void setAmPmStrings(String[] newAmpms) {
409410
ampms = duplicate(newAmpms);
410411
}
411412

412-
// /**
413-
// * Gets time zone strings. Use of this method is discouraged; use
414-
// * {@link java.util.TimeZone#getDisplayName() TimeZone.getDisplayName()}
415-
// * instead.
416-
// * <p>
417-
// * The value returned is a
418-
// * two-dimensional array of strings of size <em>n</em> by <em>m</em>,
419-
// * where <em>m</em> is at least 5. Each of the <em>n</em> rows is an
420-
// * entry containing the localized names for a single <code>TimeZone</code>.
421-
// * Each such row contains (with <code>i</code> ranging from
422-
// * 0..<em>n</em>-1):
423-
// * <ul>
424-
// * <li><code>zoneStrings[i][0]</code> - time zone ID</li>
425-
// * <li><code>zoneStrings[i][1]</code> - long name of zone in standard
426-
// * time</li>
427-
// * <li><code>zoneStrings[i][2]</code> - short name of zone in
428-
// * standard time</li>
429-
// * <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
430-
// * saving time</li>
431-
// * <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
432-
// * saving time</li>
433-
// * </ul>
434-
// * The zone ID is <em>not</em> localized; it's one of the valid IDs of
435-
// * the {@link java.util.TimeZone TimeZone} class that are not
436-
// * <a href="../util/TimeZone.html#CustomID">custom IDs</a>.
437-
// * All other entries are localized names. If a zone does not implement
438-
// * daylight saving time, the daylight saving time names should not be used.
439-
// * <p>
440-
// * If {@link #setZoneStrings(String[][]) setZoneStrings} has been called
441-
// * on this <code>DateFormatSymbols</code> instance, then the strings
442-
// * provided by that call are returned. Otherwise, the returned array
443-
// * contains names provided by the Java runtime and by installed
444-
// * {@link java.util.spi.TimeZoneNameProvider TimeZoneNameProvider}
445-
// * implementations.
446-
// *
447-
// * @return the time zone strings.
448-
// * @see #setZoneStrings(String[][])
449-
// */
450-
// public String[][] getZoneStrings() {
451-
// return getZoneStringsImpl(true);
452-
// }
413+
/**
414+
* Gets time zone strings. Use of this method is discouraged; use
415+
* {@link java.util.TimeZone#getDisplayName() TimeZone.getDisplayName()}
416+
* instead.
417+
* <p>
418+
* The value returned is a
419+
* two-dimensional array of strings of size <em>n</em> by <em>m</em>,
420+
* where <em>m</em> is at least 5. Each of the <em>n</em> rows is an
421+
* entry containing the localized names for a single <code>TimeZone</code>.
422+
* Each such row contains (with <code>i</code> ranging from
423+
* 0..<em>n</em>-1):
424+
* <ul>
425+
* <li><code>zoneStrings[i][0]</code> - time zone ID</li>
426+
* <li><code>zoneStrings[i][1]</code> - long name of zone in standard
427+
* time</li>
428+
* <li><code>zoneStrings[i][2]</code> - short name of zone in
429+
* standard time</li>
430+
* <li><code>zoneStrings[i][3]</code> - long name of zone in daylight
431+
* saving time</li>
432+
* <li><code>zoneStrings[i][4]</code> - short name of zone in daylight
433+
* saving time</li>
434+
* </ul>
435+
* The zone ID is <em>not</em> localized; it's one of the valid IDs of
436+
* the {@link java.util.TimeZone TimeZone} class that are not
437+
* <a href="../util/TimeZone.html#CustomID">custom IDs</a>.
438+
* All other entries are localized names. If a zone does not implement
439+
* daylight saving time, the daylight saving time names should not be used.
440+
* <p>
441+
* If {@link #setZoneStrings(String[][]) setZoneStrings} has been called
442+
* on this <code>DateFormatSymbols</code> instance, then the strings
443+
* provided by that call are returned. Otherwise, the returned array
444+
* contains names provided by the Java runtime and by installed
445+
* {@link java.util.spi.TimeZoneNameProvider TimeZoneNameProvider}
446+
* implementations.
447+
*
448+
* @return the time zone strings.
449+
* @see #setZoneStrings(String[][])
450+
*/
451+
public String[][] getZoneStrings() {
452+
return getZoneStringsImpl(true);
453+
}
453454

454455
/**
455456
* Sets time zone strings. The argument must be a
@@ -614,56 +615,56 @@ private void initializeData(Locale desiredLocale) {
614615
locale = desiredLocale;
615616
}
616617

617-
// /**
618-
// * Package private: used by SimpleDateFormat
619-
// * Gets the index for the given time zone ID to obtain the time zone
620-
// * strings for formatting. The time zone ID is just for programmatic
621-
// * lookup. NOT LOCALIZED!!!
622-
// * @param ID the given time zone ID.
623-
// * @return the index of the given time zone ID. Returns -1 if
624-
// * the given time zone ID can't be located in the DateFormatSymbols object.
625-
// * @see java.util.SimpleTimeZone
626-
// */
627-
// final int getZoneIndex (String ID)
628-
// {
629-
// String[][] zoneStrings = getZoneStringsWrapper();
630-
// for (int index=0; index<zoneStrings.length; index++)
631-
// {
632-
// if (ID.equalsIgnoreCase(zoneStrings[index][0])) return index;
633-
// }
634-
//
635-
// return -1;
636-
// }
618+
/**
619+
* Package private: used by SimpleDateFormat
620+
* Gets the index for the given time zone ID to obtain the time zone
621+
* strings for formatting. The time zone ID is just for programmatic
622+
* lookup. NOT LOCALIZED!!!
623+
* @param ID the given time zone ID.
624+
* @return the index of the given time zone ID. Returns -1 if
625+
* the given time zone ID can't be located in the DateFormatSymbols object.
626+
* @see java.util.SimpleTimeZone
627+
*/
628+
final int getZoneIndex (String ID)
629+
{
630+
String[][] zoneStrings = getZoneStringsWrapper();
631+
for (int index=0; index<zoneStrings.length; index++)
632+
{
633+
if (ID.equalsIgnoreCase(zoneStrings[index][0])) return index;
634+
}
637635

638-
// /**
639-
// * Wrapper method to the getZoneStrings(), which is called from inside
640-
// * the java.text package and not to mutate the returned arrays, so that
641-
// * it does not need to create a defensive copy.
642-
// */
643-
// final String[][] getZoneStringsWrapper() {
644-
// if (isSubclassObject()) {
645-
// return getZoneStrings();
646-
// } else {
647-
// return getZoneStringsImpl(false);
648-
// }
649-
// }
636+
return -1;
637+
}
638+
639+
/**
640+
* Wrapper method to the getZoneStrings(), which is called from inside
641+
* the java.text package and not to mutate the returned arrays, so that
642+
* it does not need to create a defensive copy.
643+
*/
644+
final String[][] getZoneStringsWrapper() {
645+
if (isSubclassObject()) {
646+
return getZoneStrings();
647+
} else {
648+
return getZoneStringsImpl(false);
649+
}
650+
}
651+
652+
private final String[][] getZoneStringsImpl(boolean needsCopy) {
653+
if (zoneStrings == null) {
654+
zoneStrings = TimeZoneNameUtility.getZoneStrings(locale);
655+
}
656+
657+
if (needsCopy) {
658+
String[][] aCopy = new String[zoneStrings.length][];
659+
for (int i = 0; i < zoneStrings.length; ++i) {
660+
aCopy[i] = duplicate(zoneStrings[i]);
661+
}
662+
return aCopy;
663+
} else {
664+
return zoneStrings;
665+
}
666+
}
650667

651-
// private final String[][] getZoneStringsImpl(boolean needsCopy) {
652-
// if (zoneStrings == null) {
653-
// zoneStrings = TimeZoneNameUtility.getZoneStrings(locale);
654-
// }
655-
//
656-
// if (needsCopy) {
657-
// String[][] aCopy = new String[zoneStrings.length][];
658-
// for (int i = 0; i < zoneStrings.length; ++i) {
659-
// aCopy[i] = duplicate(zoneStrings[i]);
660-
// }
661-
// return aCopy;
662-
// } else {
663-
// return zoneStrings;
664-
// }
665-
// }
666-
//
667668
@SuppressWarnings("unused")
668669
private final boolean isSubclassObject() {
669670
return !getClass().getName().equals("java.text.DateFormatSymbols");

0 commit comments

Comments
 (0)