1 7 8 package com.ibm.icu.util; 9 10 import com.ibm.icu.util.TimeZone; 11 import java.util.Date ; 12 import java.util.Locale ; 13 14 42 public class BuddhistCalendar extends GregorianCalendar { 43 private static final long serialVersionUID = 2583005278132380631L; 45 private static String copyright = "Copyright \u00a9 1998 IBM Corp. All Rights Reserved."; 46 47 51 58 public static final int BE = 0; 59 60 65 public BuddhistCalendar() { 66 super(); 67 } 68 69 76 public BuddhistCalendar(TimeZone zone) { 77 super(zone); 78 } 79 80 87 public BuddhistCalendar(Locale aLocale) { 88 super(aLocale); 89 } 90 91 99 public BuddhistCalendar(ULocale locale) { 100 super(locale); 101 } 102 103 112 public BuddhistCalendar(TimeZone zone, Locale aLocale) { 113 super(zone, aLocale); 114 } 115 116 126 public BuddhistCalendar(TimeZone zone, ULocale locale) { 127 super(zone, locale); 128 } 129 130 137 public BuddhistCalendar(Date date) { 138 this(); 139 setTime(date); 140 } 141 142 154 public BuddhistCalendar(int year, int month, int date) { 155 super(year, month, date); 156 } 157 158 176 public BuddhistCalendar(int year, int month, int date, int hour, 177 int minute, int second) 178 { 179 super(year, month, date, hour, minute, second); 180 } 181 182 183 189 private static final int BUDDHIST_ERA_START = -543; 191 192 195 protected int handleGetExtendedYear() { 196 int year; 197 if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR) { 198 year = internalGet(EXTENDED_YEAR, 1); 199 } else { 200 year = internalGet(YEAR, 1); 202 } 203 return year; 204 } 205 206 210 protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) { 211 return super.handleComputeMonthStart(eyear + BUDDHIST_ERA_START, month, useMonth); 212 } 213 214 217 protected void handleComputeFields(int julianDay) { 218 super.handleComputeFields(julianDay); 219 int y = internalGet(EXTENDED_YEAR) - BUDDHIST_ERA_START; 220 internalSet(EXTENDED_YEAR, y); 221 internalSet(ERA, 0); 222 internalSet(YEAR, y); 223 } 224 225 231 protected int handleGetLimit(int field, int limitType) { 232 if (field == ERA) { 233 return BE; 234 } 235 return super.handleGetLimit(field, limitType); 236 } 237 238 244 public String getType() { 245 return "buddhist"; 246 } 247 248 265 } 266 | Popular Tags |