21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package build.tools.cldrconverter;
27
28 import java.util.Locale;
29
30 /**
31 * Constants for the Calendars supported by JRE.
32 */
33 enum CalendarType {
34 GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC,
35 ISLAMIC, ISLAMIC_CIVIL("islamicc"), ISLAMIC_UMALQURA("islamic-umalqura");
36
37 private static final int[][] ERA_DATA = {
38 // start index, array length
39 {0, 2}, // gregorian
40 {0, 1}, // buddhist
41 {232, 4}, // japanese (eras from Meiji)
42 {0, 2}, // roc (Minguo)
43 {0, 1}, // islamic (Hijrah)
44 {0, 1}, // islamicc (same as islamic)
45 {0, 1}, // islamic-umalqura
46 };
47
48 private final String lname; // lowercase name
49 private final String uname; // unicode key name (e.g., "gregory" for GREGORIAN)
50
51 private CalendarType() {
52 this(null);
53 }
54
55 private CalendarType(String uname) {
56 String lname = name().toLowerCase(Locale.ROOT);
57 if (lname.startsWith("islamic_")) {
58 lname = lname.replace('_', '-');
59 }
60 this.lname = lname;
61 this.uname = (uname != null) ? uname : lname;
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package build.tools.cldrconverter;
27
28 import java.util.Locale;
29
30 /**
31 * Constants for the Calendars supported by JRE.
32 */
33 enum CalendarType {
34 GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC,
35 ISLAMIC, ISLAMIC_CIVIL("islamicc"), ISLAMIC_UMALQURA("islamic-umalqura");
36
37 private static final int[][] ERA_DATA = {
38 // start index, array length
39 {0, 2}, // gregorian
40 {0, 1}, // buddhist
41 {232, 5}, // japanese (eras from Meiji)
42 {0, 2}, // roc (Minguo)
43 {0, 1}, // islamic (Hijrah)
44 {0, 1}, // islamicc (same as islamic)
45 {0, 1}, // islamic-umalqura
46 };
47
48 private final String lname; // lowercase name
49 private final String uname; // unicode key name (e.g., "gregory" for GREGORIAN)
50
51 private CalendarType() {
52 this(null);
53 }
54
55 private CalendarType(String uname) {
56 String lname = name().toLowerCase(Locale.ROOT);
57 if (lname.startsWith("islamic_")) {
58 lname = lname.replace('_', '-');
59 }
60 this.lname = lname;
61 this.uname = (uname != null) ? uname : lname;
|