This commit is contained in:
konsoletyper 2014-05-18 20:00:52 +04:00
parent 2e97872496
commit 7ef412a9f1
7 changed files with 212 additions and 1810 deletions

View File

@ -0,0 +1,26 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.impl.unicode;
/**
*
* @author Alexey Andreev <konsoletyper@gmail.com>
*/
public class CLDRHelper {
public static String getCode(String language, String country) {
return !country.isEmpty() ? language + "-" + country : language;
}
}

View File

@ -32,6 +32,7 @@
package org.teavm.classlib.java.util;
import org.teavm.classlib.impl.unicode.CLDRHelper;
import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.TCloneable;
import org.teavm.classlib.java.lang.TComparable;
@ -57,8 +58,6 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
private int minimalDaysInFirstWeek;
private TimeZone zone;
public static final int JANUARY = 0;
public static final int FEBRUARY = 1;
@ -147,24 +146,24 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
"MINUTE=", "SECOND=", "MILLISECOND=", "ZONE_OFFSET=", "DST_OFFSET=" };
protected Calendar() {
this(TimeZone.getDefault(), TLocale.getDefault());
this(TLocale.getDefault());
}
Calendar(TimeZone timezone) {
protected Calendar(TLocale locale) {
fields = new int[FIELD_COUNT];
isSet = new boolean[FIELD_COUNT];
areFieldsSet = isTimeSet = false;
setLenient(true);
setTimeZone(timezone);
String localeCode = CLDRHelper.getCode(locale.getLanguage(), locale.getCountry());
setFirstDayOfWeek(getFirstDayOfWeek(localeCode));
setMinimalDaysInFirstWeek(getMinimalDaysInFirstWeek(localeCode));
}
protected Calendar(TimeZone timezone, TLocale locale) {
this(timezone);
com.ibm.icu.util.Calendar icuCalendar = com.ibm.icu.util.Calendar.getInstance(
com.ibm.icu.util.SimpleTimeZone.getTimeZone(timezone.getID()), locale);
setFirstDayOfWeek(icuCalendar.getFirstDayOfWeek());
setMinimalDaysInFirstWeek(icuCalendar.getMinimalDaysInFirstWeek());
}
// TODO: implement using CLDR
private static native int getFirstDayOfWeek(String localeCode);
// TODO: implement using CLDR
private static native int getMinimalDaysInFirstWeek(String localeCode);
abstract public void add(int field, int value);
@ -202,7 +201,6 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
Calendar clone = (Calendar) super.clone();
clone.fields = fields.clone();
clone.isSet = isSet.clone();
clone.zone = (TimeZone) zone.clone();
return clone;
} catch (CloneNotSupportedException e) {
return null;
@ -235,8 +233,7 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
Calendar cal = (Calendar) object;
return getTimeInMillis() == cal.getTimeInMillis() && isLenient() == cal.isLenient() &&
getFirstDayOfWeek() == cal.getFirstDayOfWeek() &&
getMinimalDaysInFirstWeek() == cal.getMinimalDaysInFirstWeek() &&
getTimeZone().equals(cal.getTimeZone());
getMinimalDaysInFirstWeek() == cal.getMinimalDaysInFirstWeek();
}
public int get(int field) {
@ -298,14 +295,6 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
return new GregorianCalendar(locale);
}
public static synchronized Calendar getInstance(TimeZone timezone) {
return new GregorianCalendar(timezone);
}
public static synchronized Calendar getInstance(TimeZone timezone, TLocale locale) {
return new GregorianCalendar(timezone, locale);
}
abstract public int getLeastMaximum(int field);
abstract public int getMaximum(int field);
@ -328,14 +317,9 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
return time;
}
public TimeZone getTimeZone() {
return zone;
}
@Override
public int hashCode() {
return (isLenient() ? 1237 : 1231) + getFirstDayOfWeek() + getMinimalDaysInFirstWeek() +
getTimeZone().hashCode();
return (isLenient() ? 1237 : 1231) + getFirstDayOfWeek() + getMinimalDaysInFirstWeek();
}
protected final int internalGet(int field) {
@ -417,17 +401,11 @@ public abstract class Calendar implements TSerializable, TCloneable, TComparable
}
}
public void setTimeZone(TimeZone timezone) {
zone = timezone;
areFieldsSet = false;
}
@Override
@SuppressWarnings("nls")
public String toString() {
StringBuilder result = new StringBuilder(getClass().getName() + "[time=" +
(isTimeSet ? String.valueOf(time) : "?") + ",areFieldsSet=" + areFieldsSet + ",lenient=" + lenient +
",zone=" + zone + ",firstDayOfWeek=" + firstDayOfWeek + ",minimalDaysInFirstWeek=" +
",firstDayOfWeek=" + firstDayOfWeek + ",minimalDaysInFirstWeek=" +
minimalDaysInFirstWeek);
for (int i = 0; i < FIELD_COUNT; i++) {
result.append(',');

View File

@ -37,7 +37,6 @@ import org.teavm.classlib.java.lang.TCloneable;
import org.teavm.classlib.java.lang.TComparable;
import org.teavm.classlib.java.text.DateFormat;
import org.teavm.classlib.java.text.DateFormatSymbols;
import org.teavm.classlib.java.text.SimpleDateFormat;
public class Date implements TSerializable, TCloneable, TComparable<Date> {
@ -405,16 +404,12 @@ public class Date implements TSerializable, TCloneable, TComparable<Date> {
@Deprecated
public String toGMTString() {
SimpleDateFormat format1 = new SimpleDateFormat("d MMM ", TLocale.US);
SimpleDateFormat format2 = new SimpleDateFormat(" HH:mm:ss 'GMT'", TLocale.US);
TimeZone gmtZone = TimeZone.getTimeZone("GMT");
format1.setTimeZone(gmtZone);
format2.setTimeZone(gmtZone);
GregorianCalendar gc = new GregorianCalendar(gmtZone);
gc.setTimeInMillis(milliseconds);
return format1.format(this) + gc.get(Calendar.YEAR) + format2.format(this);
return toGTMString((int)(milliseconds >> 32), (int)milliseconds);
}
// TODO: implement using native JavaScript method
private static native String toGTMString(int hidate, int lodate);
@Deprecated
public String toLocaleString() {
return DateFormat.getDateTimeInstance().format(this);
@ -422,30 +417,12 @@ public class Date implements TSerializable, TCloneable, TComparable<Date> {
@Override
public String toString() {
Calendar cal = new GregorianCalendar(milliseconds);
TimeZone zone = cal.getTimeZone();
String zoneName = zone.getDisplayName(zone.inDaylightTime(this), TimeZone.SHORT, TLocale.getDefault());
StringBuilder sb = new StringBuilder(34);
sb.append(dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1]);
sb.append(' ');
sb.append(monthNames[cal.get(Calendar.MONTH)]);
sb.append(' ');
sb.append(toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)));
sb.append(' ');
sb.append(toTwoDigits(cal.get(Calendar.HOUR_OF_DAY)));
sb.append(':');
sb.append(toTwoDigits(cal.get(Calendar.MINUTE)));
sb.append(':');
sb.append(toTwoDigits(cal.get(Calendar.SECOND)));
sb.append(' ');
sb.append(zoneName);
sb.append(' ');
sb.append(cal.get(Calendar.YEAR));
return sb.toString();
return toString((int)(milliseconds >> 32), (int)milliseconds);
}
// TODO: implement using native JavaScript method
private static native String toString(int hidate, int lodate);
private String toTwoDigits(int digit) {
if (digit >= 10) {
return "" + digit;
@ -456,10 +433,8 @@ public class Date implements TSerializable, TCloneable, TComparable<Date> {
@Deprecated
public static long UTC(int year, int month, int day, int hour, int minute, int second) {
GregorianCalendar cal = new GregorianCalendar(false);
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
cal.set(1900 + year, month, day, hour, minute, second);
return cal.getTimeInMillis();
Date date = new Date(year, month, day, hour, minute, second);
return date.milliseconds - date.getTimezoneOffset();
}
private static int zone(String text) {

View File

@ -34,23 +34,19 @@ public class GregorianCalendar extends Calendar {
private transient int changeYear = 1582;
private transient int julianSkew = ((changeYear - 2000) / 400)
+ julianError() - ((changeYear - 2000) / 100);
private transient int julianSkew = ((changeYear - 2000) / 400) + julianError() - ((changeYear - 2000) / 100);
static byte[] DaysInMonth = new byte[] { 31, 28, 31, 30, 31, 30, 31, 31,
30, 31, 30, 31 };
static byte[] DaysInMonth = new byte[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
private static int[] DaysInYear = new int[] { 0, 31, 59, 90, 120, 151, 181,
212, 243, 273, 304, 334 };
private static int[] DaysInYear = new int[] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
private static int[] maximums = new int[] { 1, 292278994, 11, 53, 6, 31,
366, 7, 6, 1, 11, 23, 59, 59, 999, 14 * 3600 * 1000, 7200000 };
private static int[] maximums = new int[] { 1, 292278994, 11, 53, 6, 31, 366, 7, 6, 1, 11, 23, 59, 59, 999,
14 * 3600 * 1000, 7200000 };
private static int[] minimums = new int[] { 0, 1, 0, 1, 0, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, -13 * 3600 * 1000, 0 };
private static int[] minimums = new int[] { 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, -13 * 3600 * 1000, 0 };
private static int[] leastMaximums = new int[] { 1, 292269054, 11, 50, 3,
28, 355, 7, 3, 1, 11, 23, 59, 59, 999, 50400000, 1200000 };
private static int[] leastMaximums = new int[] { 1, 292269054, 11, 50, 3, 28, 355, 7, 3, 1, 11, 23, 59, 59, 999,
50400000, 1200000 };
private boolean isCached;
@ -64,70 +60,19 @@ public class GregorianCalendar extends Calendar {
private int lastYearSkew = 0;
/**
* Constructs a new {@code GregorianCalendar} initialized to the current date and
* time with the default {@code Locale} and {@code TimeZone}.
*/
public GregorianCalendar() {
this(TimeZone.getDefault(), TLocale.getDefault());
this(TLocale.getDefault());
}
/**
* Constructs a new {@code GregorianCalendar} initialized to midnight in the default
* {@code TimeZone} and {@code Locale} on the specified date.
*
* @param year
* the year.
* @param month
* the month.
* @param day
* the day of the month.
*/
public GregorianCalendar(int year, int month, int day) {
super(TimeZone.getDefault(), TLocale.getDefault());
set(year, month, day);
}
/**
* Constructs a new {@code GregorianCalendar} initialized to the specified date and
* time in the default {@code TimeZone} and {@code Locale}.
*
* @param year
* the year.
* @param month
* the month.
* @param day
* the day of the month.
* @param hour
* the hour.
* @param minute
* the minute.
*/
public GregorianCalendar(int year, int month, int day, int hour, int minute) {
super(TimeZone.getDefault(), TLocale.getDefault());
set(year, month, day, hour, minute);
}
/**
* Constructs a new {@code GregorianCalendar} initialized to the specified date and
* time in the default {@code TimeZone} and {@code Locale}.
*
* @param year
* the year.
* @param month
* the month.
* @param day
* the day of the month.
* @param hour
* the hour.
* @param minute
* the minute.
* @param second
* the second.
*/
public GregorianCalendar(int year, int month, int day, int hour,
int minute, int second) {
super(TimeZone.getDefault(), TLocale.getDefault());
public GregorianCalendar(int year, int month, int day, int hour, int minute, int second) {
set(year, month, day, hour, minute, second);
}
@ -136,59 +81,16 @@ public class GregorianCalendar extends Calendar {
setTimeInMillis(milliseconds);
}
/**
* Constructs a new {@code GregorianCalendar} initialized to the current date and
* time and using the specified {@code Locale} and the default {@code TimeZone}.
*
* @param locale
* the {@code Locale}.
*/
public GregorianCalendar(TLocale locale) {
this(TimeZone.getDefault(), locale);
}
/**
* Constructs a new {@code GregorianCalendar} initialized to the current date and
* time and using the specified {@code TimeZone} and the default {@code Locale}.
*
* @param timezone
* the {@code TimeZone}.
*/
public GregorianCalendar(TimeZone timezone) {
this(timezone, TLocale.getDefault());
}
/**
* Constructs a new {@code GregorianCalendar} initialized to the current date and
* time and using the specified {@code TimeZone} and {@code Locale}.
*
* @param timezone
* the {@code TimeZone}.
* @param locale
* the {@code Locale}.
*/
public GregorianCalendar(TimeZone timezone, TLocale locale) {
super(timezone, locale);
super(locale);
setTimeInMillis(System.currentTimeMillis());
}
GregorianCalendar(@SuppressWarnings("unused") boolean ignored) {
super(TimeZone.getDefault());
setFirstDayOfWeek(SUNDAY);
setMinimalDaysInFirstWeek(1);
}
/**
* Adds the specified amount to a {@code Calendar} field.
*
* @param field
* the {@code Calendar} field to modify.
* @param value
* the amount to add to the field.
*
* @throws IllegalArgumentException
* if the specified field is DST_OFFSET or ZONE_OFFSET.
*/
@Override
public void add(int field, int value) {
if (value == 0) {
@ -269,10 +171,9 @@ public class GregorianCalendar extends Calendar {
break;
}
if (multiplier > 0) {
int zoneOffset = getTimeZone().getRawOffset();
int offset = getOffset(time + zoneOffset);
int offset = getTimeZoneOffset((int)(time >> 32), (int)time);
time += value * multiplier;
int newOffset = getOffset(time + zoneOffset);
int newOffset = getTimeZoneOffset((int)(time >> 32), (int)time);
// Adjust for moving over a DST boundary
if (newOffset != offset) {
time += offset - newOffset;
@ -282,14 +183,9 @@ public class GregorianCalendar extends Calendar {
complete();
}
/**
* Creates new instance of {@code GregorianCalendar} with the same properties.
*
* @return a shallow copy of this {@code GregorianCalendar}.
*/
@Override
public Object clone() {
GregorianCalendar thisClone = (GregorianCalendar) super.clone();
GregorianCalendar thisClone = (GregorianCalendar)super.clone();
thisClone.cachedFields = cachedFields.clone();
return thisClone;
}
@ -314,7 +210,7 @@ public class GregorianCalendar extends Calendar {
int dayOfYear = computeYearAndDay(days, timeVal + zoneOffset);
fields[DAY_OF_YEAR] = dayOfYear;
if(fields[YEAR] == changeYear && gregorianCutover <= timeVal + zoneOffset){
if (fields[YEAR] == changeYear && gregorianCutover <= timeVal + zoneOffset) {
dayOfYear += currentYearSkew;
}
int month = dayOfYear / 32;
@ -325,8 +221,7 @@ public class GregorianCalendar extends Calendar {
month++;
}
fields[DAY_OF_WEEK] = mod7(days - 3) + 1;
int dstOffset = fields[YEAR] <= 0 ? 0 : getTimeZone().getOffset(AD,
fields[YEAR], month, date, fields[DAY_OF_WEEK], millis);
int dstOffset = getTimeZoneOffset((int)(timeVal >> 32), (int)timeVal);
if (fields[YEAR] > 0) {
dstOffset -= zoneOffset;
}
@ -342,10 +237,9 @@ public class GregorianCalendar extends Calendar {
days++;
}
if (oldDays != days) {
dayOfYear = computeYearAndDay(days, timeVal - zoneOffset
+ dstOffset);
dayOfYear = computeYearAndDay(days, timeVal - zoneOffset + dstOffset);
fields[DAY_OF_YEAR] = dayOfYear;
if(fields[YEAR] == changeYear && gregorianCutover <= timeVal - zoneOffset + dstOffset){
if (fields[YEAR] == changeYear && gregorianCutover <= timeVal - zoneOffset + dstOffset) {
dayOfYear += currentYearSkew;
}
month = dayOfYear / 32;
@ -378,18 +272,14 @@ public class GregorianCalendar extends Calendar {
fields[MONTH] = month;
fields[DATE] = date;
fields[DAY_OF_WEEK_IN_MONTH] = (date - 1) / 7 + 1;
fields[WEEK_OF_MONTH] = (date - 1 + mod7(days - date - 2
- (getFirstDayOfWeek() - 1))) / 7 + 1;
int daysFromStart = mod7(days - 3 - (fields[DAY_OF_YEAR] - 1)
- (getFirstDayOfWeek() - 1));
int week = (fields[DAY_OF_YEAR] - 1 + daysFromStart) / 7
+ (7 - daysFromStart >= getMinimalDaysInFirstWeek() ? 1 : 0);
fields[WEEK_OF_MONTH] = (date - 1 + mod7(days - date - 2 - (getFirstDayOfWeek() - 1))) / 7 + 1;
int daysFromStart = mod7(days - 3 - (fields[DAY_OF_YEAR] - 1) - (getFirstDayOfWeek() - 1));
int week = (fields[DAY_OF_YEAR] - 1 + daysFromStart) / 7 +
(7 - daysFromStart >= getMinimalDaysInFirstWeek() ? 1 : 0);
if (week == 0) {
fields[WEEK_OF_YEAR] = 7 - mod7(daysFromStart
- (isLeapYear(fields[YEAR] - 1) ? 2 : 1)) >= getMinimalDaysInFirstWeek() ? 53
: 52;
} else if (fields[DAY_OF_YEAR] >= (leapYear ? 367 : 366)
- mod7(daysFromStart + (leapYear ? 2 : 1))) {
fields[WEEK_OF_YEAR] = 7 - mod7(daysFromStart -
(isLeapYear(fields[YEAR] - 1) ? 2 : 1)) >= getMinimalDaysInFirstWeek() ? 53 : 52;
} else if (fields[DAY_OF_YEAR] >= (leapYear ? 367 : 366) - mod7(daysFromStart + (leapYear ? 2 : 1))) {
fields[WEEK_OF_YEAR] = 7 - mod7(daysFromStart + (leapYear ? 2 : 1)) >= getMinimalDaysInFirstWeek() ? 1
: week;
} else {
@ -397,16 +287,12 @@ public class GregorianCalendar extends Calendar {
}
}
private final void cachedFieldsCheckAndGet(long timeVal,
long newTimeMillis, long newTimeMillisAdjusted, int millis,
int zoneOffset) {
private final void cachedFieldsCheckAndGet(long timeVal, long newTimeMillis, long newTimeMillisAdjusted,
int millis, int zoneOffset) {
int dstOffset = fields[DST_OFFSET];
if (!isCached
|| newTimeMillis >= nextMidnightMillis
|| newTimeMillis <= lastMidnightMillis
|| cachedFields[4] != zoneOffset
|| (dstOffset == 0 && (newTimeMillisAdjusted >= nextMidnightMillis))
|| (dstOffset != 0 && (newTimeMillisAdjusted <= lastMidnightMillis))) {
if (!isCached || newTimeMillis >= nextMidnightMillis || newTimeMillis <= lastMidnightMillis ||
cachedFields[4] != zoneOffset || (dstOffset == 0 && (newTimeMillisAdjusted >= nextMidnightMillis)) ||
(dstOffset != 0 && (newTimeMillisAdjusted <= lastMidnightMillis))) {
fullFieldsCalc(timeVal, millis, zoneOffset);
isCached = false;
} else {
@ -422,15 +308,18 @@ public class GregorianCalendar extends Calendar {
}
}
// TODO: implement using JavaScript native method
private static native int getTimeZoneOffset(int hitime, int lotime);
@Override
protected void computeFields() {
int zoneOffset = getTimeZone().getRawOffset();
int zoneOffset = getTimeZoneOffset((int)(time >>> 32), (int)time);
if(!isSet[ZONE_OFFSET]) {
if (!isSet[ZONE_OFFSET]) {
fields[ZONE_OFFSET] = zoneOffset;
}
int millis = (int) (time % 86400000);
int millis = (int)(time % 86400000);
int savedMillis = millis;
int dstOffset = fields[DST_OFFSET];
// compute without a change in daylight saving time
@ -470,20 +359,13 @@ public class GregorianCalendar extends Calendar {
fields[HOUR] = fields[HOUR_OF_DAY] % 12;
long newTimeAdjusted = newTime;
if (getTimeZone().useDaylightTime()) {
int dstSavings = ((SimpleTimeZone) getTimeZone())
.getDSTSavings();
newTimeAdjusted += (dstOffset == 0) ? dstSavings : -dstSavings;
}
if (newTime > 0L && newTimeAdjusted < 0L && dstOffset == 0) {
newTimeAdjusted = 0x7fffffffffffffffL;
} else if (newTime < 0L && newTimeAdjusted > 0L && dstOffset != 0) {
newTimeAdjusted = 0x8000000000000000L;
}
cachedFieldsCheckAndGet(time, newTime, newTimeAdjusted,
savedMillis, zoneOffset);
cachedFieldsCheckAndGet(time, newTime, newTimeAdjusted, savedMillis, zoneOffset);
} else {
fullFieldsCalc(time, savedMillis, zoneOffset);
}
@ -493,10 +375,7 @@ public class GregorianCalendar extends Calendar {
}
// Caching
if (!isCached
&& newTime != 0x7fffffffffffffffL
&& newTime != 0x8000000000000000L
&& (!getTimeZone().useDaylightTime() || getTimeZone() instanceof SimpleTimeZone)) {
if (!isCached && newTime != 0x7fffffffffffffffL && newTime != 0x8000000000000000L) {
int cacheMillis = 0;
cachedFields[0] = fields[YEAR];
@ -540,24 +419,19 @@ public class GregorianCalendar extends Calendar {
if (isSet[SECOND] && (fields[SECOND] < 0 || fields[SECOND] > 59)) {
throw new IllegalArgumentException();
}
if (isSet[MILLISECOND]
&& (fields[MILLISECOND] < 0 || fields[MILLISECOND] > 999)) {
if (isSet[MILLISECOND] && (fields[MILLISECOND] < 0 || fields[MILLISECOND] > 999)) {
throw new IllegalArgumentException();
}
if (isSet[WEEK_OF_YEAR]
&& (fields[WEEK_OF_YEAR] < 1 || fields[WEEK_OF_YEAR] > 53)) {
if (isSet[WEEK_OF_YEAR] && (fields[WEEK_OF_YEAR] < 1 || fields[WEEK_OF_YEAR] > 53)) {
throw new IllegalArgumentException();
}
if (isSet[DAY_OF_WEEK]
&& (fields[DAY_OF_WEEK] < 1 || fields[DAY_OF_WEEK] > 7)) {
if (isSet[DAY_OF_WEEK] && (fields[DAY_OF_WEEK] < 1 || fields[DAY_OF_WEEK] > 7)) {
throw new IllegalArgumentException();
}
if (isSet[DAY_OF_WEEK_IN_MONTH]
&& (fields[DAY_OF_WEEK_IN_MONTH] < 1 || fields[DAY_OF_WEEK_IN_MONTH] > 6)) {
if (isSet[DAY_OF_WEEK_IN_MONTH] && (fields[DAY_OF_WEEK_IN_MONTH] < 1 || fields[DAY_OF_WEEK_IN_MONTH] > 6)) {
throw new IllegalArgumentException();
}
if (isSet[WEEK_OF_MONTH]
&& (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > 6)) {
if (isSet[WEEK_OF_MONTH] && (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > 6)) {
throw new IllegalArgumentException();
}
if (isSet[AM_PM] && fields[AM_PM] != AM && fields[AM_PM] != PM) {
@ -567,8 +441,7 @@ public class GregorianCalendar extends Calendar {
throw new IllegalArgumentException();
}
if (isSet[YEAR]) {
if (isSet[ERA] && fields[ERA] == BC
&& (fields[YEAR] < 1 || fields[YEAR] > 292269054)) {
if (isSet[ERA] && fields[ERA] == BC && (fields[YEAR] < 1 || fields[YEAR] > 292269054)) {
throw new IllegalArgumentException();
} else if (fields[YEAR] < 1 || fields[YEAR] > 292278994) {
throw new IllegalArgumentException();
@ -589,10 +462,10 @@ public class GregorianCalendar extends Calendar {
timeVal = hour * 3600000;
if (isSet[MINUTE]) {
timeVal += ((long) fields[MINUTE]) * 60000;
timeVal += ((long)fields[MINUTE]) * 60000;
}
if (isSet[SECOND]) {
timeVal += ((long) fields[SECOND]) * 1000;
timeVal += ((long)fields[SECOND]) * 1000;
}
if (isSet[MILLISECOND]) {
timeVal += fields[MILLISECOND];
@ -610,15 +483,11 @@ public class GregorianCalendar extends Calendar {
}
}
boolean weekMonthSet = isSet[WEEK_OF_MONTH]
|| isSet[DAY_OF_WEEK_IN_MONTH];
boolean useMonth = (isSet[DATE] || isSet[MONTH] || weekMonthSet)
&& lastDateFieldSet != DAY_OF_YEAR;
if (useMonth
&& (lastDateFieldSet == DAY_OF_WEEK || lastDateFieldSet == WEEK_OF_YEAR)) {
boolean weekMonthSet = isSet[WEEK_OF_MONTH] || isSet[DAY_OF_WEEK_IN_MONTH];
boolean useMonth = (isSet[DATE] || isSet[MONTH] || weekMonthSet) && lastDateFieldSet != DAY_OF_YEAR;
if (useMonth && (lastDateFieldSet == DAY_OF_WEEK || lastDateFieldSet == WEEK_OF_YEAR)) {
if (isSet[WEEK_OF_YEAR] && isSet[DAY_OF_WEEK]) {
useMonth = lastDateFieldSet != WEEK_OF_YEAR && weekMonthSet
&& isSet[DAY_OF_WEEK];
useMonth = lastDateFieldSet != WEEK_OF_YEAR && weekMonthSet && isSet[DAY_OF_WEEK];
} else if (isSet[DAY_OF_YEAR]) {
useMonth = isSet[DATE] && isSet[MONTH];
}
@ -635,15 +504,12 @@ public class GregorianCalendar extends Calendar {
boolean leapYear = isLeapYear(year);
days = daysFromBaseYear(year) + daysInYear(leapYear, month);
boolean useDate = isSet[DATE];
if (useDate
&& (lastDateFieldSet == DAY_OF_WEEK
|| lastDateFieldSet == WEEK_OF_MONTH || lastDateFieldSet == DAY_OF_WEEK_IN_MONTH)) {
if (useDate &&
(lastDateFieldSet == DAY_OF_WEEK || lastDateFieldSet == WEEK_OF_MONTH || lastDateFieldSet == DAY_OF_WEEK_IN_MONTH)) {
useDate = !(isSet[DAY_OF_WEEK] && weekMonthSet);
}
if (useDate) {
if (!isLenient()
&& (fields[DATE] < 1 || fields[DATE] > daysInMonth(
leapYear, month))) {
if (!isLenient() && (fields[DATE] < 1 || fields[DATE] > daysInMonth(leapYear, month))) {
throw new IllegalArgumentException();
}
days += fields[DATE] - 1;
@ -654,20 +520,16 @@ public class GregorianCalendar extends Calendar {
} else {
dayOfWeek = getFirstDayOfWeek() - 1;
}
if (isSet[WEEK_OF_MONTH]
&& lastDateFieldSet != DAY_OF_WEEK_IN_MONTH) {
if (isSet[WEEK_OF_MONTH] && lastDateFieldSet != DAY_OF_WEEK_IN_MONTH) {
int skew = mod7(days - 3 - (getFirstDayOfWeek() - 1));
days += (fields[WEEK_OF_MONTH] - 1) * 7
+ mod7(skew + dayOfWeek - (days - 3)) - skew;
days += (fields[WEEK_OF_MONTH] - 1) * 7 + mod7(skew + dayOfWeek - (days - 3)) - skew;
} else if (isSet[DAY_OF_WEEK_IN_MONTH]) {
if (fields[DAY_OF_WEEK_IN_MONTH] >= 0) {
days += mod7(dayOfWeek - (days - 3))
+ (fields[DAY_OF_WEEK_IN_MONTH] - 1) * 7;
days += mod7(dayOfWeek - (days - 3)) + (fields[DAY_OF_WEEK_IN_MONTH] - 1) * 7;
} else {
days += daysInMonth(leapYear, month)
+ mod7(dayOfWeek
- (days + daysInMonth(leapYear, month) - 3))
+ fields[DAY_OF_WEEK_IN_MONTH] * 7;
days += daysInMonth(leapYear, month) +
mod7(dayOfWeek - (days + daysInMonth(leapYear, month) - 3)) +
fields[DAY_OF_WEEK_IN_MONTH] * 7;
}
} else if (isSet[DAY_OF_WEEK]) {
int skew = mod7(days - 3 - (getFirstDayOfWeek() - 1));
@ -675,8 +537,7 @@ public class GregorianCalendar extends Calendar {
}
}
} else {
boolean useWeekYear = isSet[WEEK_OF_YEAR]
&& lastDateFieldSet != DAY_OF_YEAR;
boolean useWeekYear = isSet[WEEK_OF_YEAR] && lastDateFieldSet != DAY_OF_YEAR;
if (useWeekYear && isSet[DAY_OF_YEAR]) {
useWeekYear = isSet[DAY_OF_WEEK];
}
@ -689,15 +550,13 @@ public class GregorianCalendar extends Calendar {
dayOfWeek = getFirstDayOfWeek() - 1;
}
int skew = mod7(days - 3 - (getFirstDayOfWeek() - 1));
days += (fields[WEEK_OF_YEAR] - 1) * 7
+ mod7(skew + dayOfWeek - (days - 3)) - skew;
days += (fields[WEEK_OF_YEAR] - 1) * 7 + mod7(skew + dayOfWeek - (days - 3)) - skew;
if (7 - skew < getMinimalDaysInFirstWeek()) {
days += 7;
}
} else if (isSet[DAY_OF_YEAR]) {
if (!isLenient()
&& (fields[DAY_OF_YEAR] < 1 || fields[DAY_OF_YEAR] > (365 + (isLeapYear(year) ? 1
: 0)))) {
if (!isLenient() &&
(fields[DAY_OF_YEAR] < 1 || fields[DAY_OF_YEAR] > (365 + (isLeapYear(year) ? 1 : 0)))) {
throw new IllegalArgumentException();
}
days += fields[DAY_OF_YEAR] - 1;
@ -709,22 +568,11 @@ public class GregorianCalendar extends Calendar {
timeVal += days * 86400000;
// Use local time to compare with the gregorian change
if (year == changeYear
&& timeVal >= gregorianCutover + julianError() * 86400000L) {
if (year == changeYear && timeVal >= gregorianCutover + julianError() * 86400000L) {
timeVal -= julianError() * 86400000L;
}
// It is not possible to simply subtract getOffset(timeVal) from timeVal
// to get UTC.
// The trick is needed for the moment when DST transition occurs,
// say 1:00 is a transition time when DST offset becomes +1 hour,
// then wall time in the interval 1:00 - 2:00 is invalid and is
// treated as UTC time.
long timeValWithoutDST = timeVal - getOffset(timeVal)
+ getTimeZone().getRawOffset();
timeVal -= getOffset(timeValWithoutDST);
// Need to update wall time in fields, since it was invalid due to DST
// transition
long timeValWithoutDST = timeVal - getTimeZoneOffset((int)(timeVal >> 32), (int)timeVal);
this.time = timeVal;
if (timeValWithoutDST != timeVal) {
computeFields();
@ -740,7 +588,7 @@ public class GregorianCalendar extends Calendar {
}
int approxYears;
while ((approxYears = (int) (days / 365)) != 0) {
while ((approxYears = (int)(days / 365)) != 0) {
year = year + approxYears;
days = dayCount - daysFromBaseYear(year);
}
@ -749,7 +597,7 @@ public class GregorianCalendar extends Calendar {
days = days + daysInYear(year);
}
fields[YEAR] = year;
return (int) days + 1;
return (int)days + 1;
}
private long daysFromBaseYear(int iyear) {
@ -760,11 +608,11 @@ public class GregorianCalendar extends Calendar {
if (year > changeYear) {
days -= ((year - 1901) / 100) - ((year - 1601) / 400);
} else {
if(year == changeYear){
if (year == changeYear) {
days += currentYearSkew;
}else if(year == changeYear -1){
} else if (year == changeYear - 1) {
days += lastYearSkew;
}else{
} else {
days += julianSkew;
}
}
@ -772,8 +620,7 @@ public class GregorianCalendar extends Calendar {
} else if (year <= changeYear) {
return (year - 1970) * 365 + ((year - 1972) / 4) + julianSkew;
}
return (year - 1970) * 365 + ((year - 1972) / 4)
- ((year - 2000) / 100) + ((year - 2000) / 400);
return (year - 1970) * 365 + ((year - 1972) / 4) - ((year - 2000) / 100) + ((year - 2000) / 400);
}
private int daysInMonth() {
@ -808,23 +655,23 @@ public class GregorianCalendar extends Calendar {
}
/**
* Compares the specified {@code Object} to this {@code GregorianCalendar} and returns whether
* they are equal. To be equal, the {@code Object} must be an instance of {@code GregorianCalendar} and
* have the same properties.
* Compares the specified {@code Object} to this {@code GregorianCalendar}
* and returns whether they are equal. To be equal, the {@code Object} must
* be an instance of {@code GregorianCalendar} and have the same properties.
*
* @param object
* the {@code Object} to compare with this {@code GregorianCalendar}.
* the {@code Object} to compare with this
* {@code GregorianCalendar}.
* @return {@code true} if {@code object} is equal to this
* {@code GregorianCalendar}, {@code false} otherwise.
* @throws IllegalArgumentException
* if the time is not set and the time cannot be computed
* from the current field values.
* if the time is not set and the time cannot be computed from
* the current field values.
* @see #hashCode
*/
@Override
public boolean equals(Object object) {
return super.equals(object)
&& gregorianCutover == ((GregorianCalendar) object).gregorianCutover;
return super.equals(object) && gregorianCutover == ((GregorianCalendar)object).gregorianCutover;
}
/**
@ -873,11 +720,10 @@ public class GregorianCalendar extends Calendar {
case DAY_OF_YEAR:
return daysInYear(fields[YEAR]);
case DAY_OF_WEEK_IN_MONTH:
result = get(DAY_OF_WEEK_IN_MONTH)
+ ((daysInMonth() - get(DATE)) / 7);
result = get(DAY_OF_WEEK_IN_MONTH) + ((daysInMonth() - get(DATE)) / 7);
break;
case YEAR:
GregorianCalendar clone = (GregorianCalendar) clone();
GregorianCalendar clone = (GregorianCalendar)clone();
if (get(ERA) == AD) {
clone.setTimeInMillis(Long.MAX_VALUE);
} else {
@ -899,8 +745,7 @@ public class GregorianCalendar extends Calendar {
/**
* Gets the minimum value of the specified field for the current date. For
* the gregorian calendar, this value is the same as
* {@code getMinimum()}.
* the gregorian calendar, this value is the same as {@code getMinimum()}.
*
* @param field
* the field.
@ -946,8 +791,7 @@ public class GregorianCalendar extends Calendar {
public int getLeastMaximum(int field) {
// return value for WEEK_OF_YEAR should make corresponding changes when
// the gregorian change date have been reset.
if (gregorianCutover != defaultGregorianCutover
&& field == WEEK_OF_YEAR) {
if (gregorianCutover != defaultGregorianCutover && field == WEEK_OF_YEAR) {
long currentTimeInMillis = time;
setTimeInMillis(gregorianCutover);
int actual = getActualMaximum(field);
@ -982,55 +826,6 @@ public class GregorianCalendar extends Calendar {
return minimums[field];
}
int getOffset(long localTime) {
TimeZone timeZone = getTimeZone();
if (!timeZone.useDaylightTime()) {
return timeZone.getRawOffset();
}
long dayCount = localTime / 86400000;
int millis = (int) (localTime % 86400000);
if (millis < 0) {
millis += 86400000;
dayCount--;
}
int year = 1970;
long days = dayCount;
if (localTime < gregorianCutover) {
days -= julianSkew;
}
int approxYears;
while ((approxYears = (int) (days / 365)) != 0) {
year = year + approxYears;
days = dayCount - daysFromBaseYear(year);
}
if (days < 0) {
year = year - 1;
days = days + 365 + (isLeapYear(year) ? 1 : 0);
if (year == changeYear && localTime < gregorianCutover) {
days -= julianError();
}
}
if (year <= 0) {
return timeZone.getRawOffset();
}
int dayOfYear = (int) days + 1;
int month = dayOfYear / 32;
boolean leapYear = isLeapYear(year);
int date = dayOfYear - daysInYear(leapYear, month);
if (date > daysInMonth(leapYear, month)) {
date -= daysInMonth(leapYear, month);
month++;
}
int dayOfWeek = mod7(dayCount - 3) + 1;
int offset = timeZone.getOffset(AD, year, month, date, dayOfWeek,
millis);
return offset;
}
/**
* Returns an integer hash code for the receiver. Objects which are equal
* return the same value for this method.
@ -1041,8 +836,7 @@ public class GregorianCalendar extends Calendar {
*/
@Override
public int hashCode() {
return super.hashCode()
+ ((int) (gregorianCutover >>> 32) ^ (int) gregorianCutover);
return super.hashCode() + ((int)(gregorianCutover >>> 32) ^ (int)gregorianCutover);
}
/**
@ -1074,7 +868,7 @@ public class GregorianCalendar extends Calendar {
}
private int mod7(long num1) {
int rem = (int) (num1 % 7);
int rem = (int)(num1 % 7);
if (num1 < 0 && rem < 0) {
return rem + 7;
}
@ -1116,8 +910,7 @@ public class GregorianCalendar extends Calendar {
case WEEK_OF_YEAR:
days = daysInYear(fields[YEAR]);
day = DAY_OF_YEAR;
mod = mod7(fields[DAY_OF_WEEK] - fields[day]
- (getFirstDayOfWeek() - 1));
mod = mod7(fields[DAY_OF_WEEK] - fields[day] - (getFirstDayOfWeek() - 1));
maxWeeks = (days - 1 + mod) / 7 + 1;
newWeek = mod(fields[field] - 1 + value, maxWeeks) + 1;
if (newWeek == maxWeeks) {
@ -1141,8 +934,7 @@ public class GregorianCalendar extends Calendar {
case WEEK_OF_MONTH:
days = daysInMonth();
day = DATE;
mod = mod7(fields[DAY_OF_WEEK] - fields[day]
- (getFirstDayOfWeek() - 1));
mod = mod7(fields[DAY_OF_WEEK] - fields[day] - (getFirstDayOfWeek() - 1));
maxWeeks = (days - 1 + mod) / 7 + 1;
newWeek = mod(fields[field] - 1 + value, maxWeeks) + 1;
if (newWeek == maxWeeks) {
@ -1226,18 +1018,17 @@ public class GregorianCalendar extends Calendar {
*/
public void setGregorianChange(Date date) {
gregorianCutover = date.getTime();
GregorianCalendar cal = new GregorianCalendar(TimeZone.GMT);
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
changeYear = cal.get(YEAR);
if (cal.get(ERA) == BC) {
changeYear = 1 - changeYear;
}
julianSkew = ((changeYear - 2000) / 400) + julianError()
- ((changeYear - 2000) / 100);
julianSkew = ((changeYear - 2000) / 400) + julianError() - ((changeYear - 2000) / 100);
isCached = false;
int dayOfYear = cal.get(DAY_OF_YEAR);
if (dayOfYear < julianSkew) {
currentYearSkew = dayOfYear-1;
currentYearSkew = dayOfYear - 1;
lastYearSkew = julianSkew - dayOfYear + 1;
} else {
lastYearSkew = 0;

View File

@ -1,373 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.util;
public class SimpleTimeZone extends TimeZone {
private int rawOffset;
private int startYear, startMonth, startDay, startDayOfWeek, startTime;
private int endMonth, endDay, endDayOfWeek, endTime;
private int startMode, endMode;
private static final int DOM_MODE = 1, DOW_IN_MONTH_MODE = 2, DOW_GE_DOM_MODE = 3, DOW_LE_DOM_MODE = 4;
public static final int UTC_TIME = 2;
public static final int STANDARD_TIME = 1;
public static final int WALL_TIME = 0;
private boolean useDaylight;
private GregorianCalendar daylightSavings;
private int dstSavings = 3600000;
private final transient boolean isSimple;
public SimpleTimeZone(int offset, final String name) {
setID(name);
rawOffset = offset;
icuTZ = getICUTimeZone(name);
if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
isSimple = true;
icuTZ.setRawOffset(offset);
} else {
isSimple = false;
}
useDaylight = icuTZ.useDaylightTime();
}
public SimpleTimeZone(int offset, String name, int startMonth, int startDay, int startDayOfWeek, int startTime,
int endMonth, int endDay, int endDayOfWeek, int endTime) {
this(offset, name, startMonth, startDay, startDayOfWeek, startTime, endMonth, endDay, endDayOfWeek, endTime,
3600000);
}
public SimpleTimeZone(int offset, String name, int startMonth, int startDay, int startDayOfWeek, int startTime,
int endMonth, int endDay, int endDayOfWeek, int endTime, int daylightSavings) {
icuTZ = getICUTimeZone(name);
if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
isSimple = true;
com.ibm.icu.util.SimpleTimeZone tz = (com.ibm.icu.util.SimpleTimeZone) icuTZ;
tz.setRawOffset(offset);
tz.setStartRule(startMonth, startDay, startDayOfWeek, startTime);
tz.setEndRule(endMonth, endDay, endDayOfWeek, endTime);
tz.setDSTSavings(daylightSavings);
} else {
isSimple = false;
}
setID(name);
rawOffset = offset;
if (daylightSavings <= 0) {
throw new IllegalArgumentException(String.valueOf(daylightSavings));
}
dstSavings = daylightSavings;
setStartRule(startMonth, startDay, startDayOfWeek, startTime);
setEndRule(endMonth, endDay, endDayOfWeek, endTime);
useDaylight = daylightSavings > 0 || icuTZ.useDaylightTime();
}
public SimpleTimeZone(int offset, String name, int startMonth, int startDay, int startDayOfWeek, int startTime,
int startTimeMode, int endMonth, int endDay, int endDayOfWeek, int endTime, int endTimeMode,
int daylightSavings) {
this(offset, name, startMonth, startDay, startDayOfWeek, startTime, endMonth, endDay, endDayOfWeek, endTime,
daylightSavings);
startMode = startTimeMode;
endMode = endTimeMode;
}
@Override
public Object clone() {
SimpleTimeZone zone = (SimpleTimeZone) super.clone();
if (daylightSavings != null) {
zone.daylightSavings = (GregorianCalendar) daylightSavings.clone();
}
return zone;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof SimpleTimeZone)) {
return false;
}
SimpleTimeZone tz = (SimpleTimeZone) object;
return getID().equals(tz.getID()) &&
rawOffset == tz.rawOffset &&
useDaylight == tz.useDaylight &&
(!useDaylight || (startYear == tz.startYear && startMonth == tz.startMonth && startDay == tz.startDay &&
startMode == tz.startMode && startDayOfWeek == tz.startDayOfWeek && startTime == tz.startTime &&
endMonth == tz.endMonth && endDay == tz.endDay && endDayOfWeek == tz.endDayOfWeek &&
endTime == tz.endTime && endMode == tz.endMode && dstSavings == tz.dstSavings));
}
@Override
public int getDSTSavings() {
if (!useDaylight) {
return 0;
}
return dstSavings;
}
@Override
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int time) {
if (era != GregorianCalendar.BC && era != GregorianCalendar.AD) {
throw new IllegalArgumentException(String.valueOf(era));
}
checkRange(month, dayOfWeek, time);
if (month != Calendar.FEBRUARY || day != 29 || !isLeapYear(year)) {
checkDay(month, day);
}
return icuTZ.getOffset(era, year, month, day, dayOfWeek, time);
}
@Override
public int getOffset(long time) {
return icuTZ.getOffset(time);
}
@Override
public int getRawOffset() {
return rawOffset;
}
@Override
public synchronized int hashCode() {
int hashCode = getID().hashCode() + rawOffset;
if (useDaylight) {
hashCode += startYear + startMonth + startDay + startDayOfWeek + startTime + startMode + endMonth + endDay +
endDayOfWeek + endTime + endMode + dstSavings;
}
return hashCode;
}
@Override
public boolean hasSameRules(TimeZone zone) {
if (!(zone instanceof SimpleTimeZone)) {
return false;
}
SimpleTimeZone tz = (SimpleTimeZone) zone;
if (useDaylight != tz.useDaylight) {
return false;
}
if (!useDaylight) {
return rawOffset == tz.rawOffset;
}
return rawOffset == tz.rawOffset && dstSavings == tz.dstSavings && startYear == tz.startYear &&
startMonth == tz.startMonth && startDay == tz.startDay && startMode == tz.startMode &&
startDayOfWeek == tz.startDayOfWeek && startTime == tz.startTime && endMonth == tz.endMonth &&
endDay == tz.endDay && endDayOfWeek == tz.endDayOfWeek && endTime == tz.endTime &&
endMode == tz.endMode;
}
@Override
public boolean inDaylightTime(Date time) {
return icuTZ.inDaylightTime(time);
}
private boolean isLeapYear(int year) {
if (year > 1582) {
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
return year % 4 == 0;
}
public void setDSTSavings(int milliseconds) {
if (milliseconds > 0) {
dstSavings = milliseconds;
} else {
throw new IllegalArgumentException();
}
}
private void checkRange(int month, int dayOfWeek, int time) {
if (month < Calendar.JANUARY || month > Calendar.DECEMBER) {
throw new IllegalArgumentException(String.valueOf(month));
}
if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) {
throw new IllegalArgumentException(String.valueOf(dayOfWeek));
}
if (time < 0 || time >= 24 * 3600000) {
throw new IllegalArgumentException(String.valueOf(time));
}
}
private void checkDay(int month, int day) {
if (day <= 0 || day > GregorianCalendar.DaysInMonth[month]) {
throw new IllegalArgumentException(String.valueOf(day));
}
}
private void setEndMode() {
if (endDayOfWeek == 0) {
endMode = DOM_MODE;
} else if (endDayOfWeek < 0) {
endDayOfWeek = -endDayOfWeek;
if (endDay < 0) {
endDay = -endDay;
endMode = DOW_LE_DOM_MODE;
} else {
endMode = DOW_GE_DOM_MODE;
}
} else {
endMode = DOW_IN_MONTH_MODE;
}
useDaylight = startDay != 0 && endDay != 0;
if (endDay != 0) {
checkRange(endMonth, endMode == DOM_MODE ? 1 : endDayOfWeek, endTime);
if (endMode != DOW_IN_MONTH_MODE) {
checkDay(endMonth, endDay);
} else {
if (endDay < -5 || endDay > 5) {
throw new IllegalArgumentException(Messages.getString("luni.40", endDay)); //$NON-NLS-1$
}
}
}
if (endMode != DOM_MODE) {
endDayOfWeek--;
}
}
public void setEndRule(int month, int dayOfMonth, int time) {
endMonth = month;
endDay = dayOfMonth;
endDayOfWeek = 0; // Initialize this value for hasSameRules()
endTime = time;
setEndMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, dayOfMonth, time);
}
}
public void setEndRule(int month, int day, int dayOfWeek, int time) {
endMonth = month;
endDay = day;
endDayOfWeek = dayOfWeek;
endTime = time;
setEndMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day, dayOfWeek, time);
}
}
public void setEndRule(int month, int day, int dayOfWeek, int time, boolean after) {
endMonth = month;
endDay = after ? day : -day;
endDayOfWeek = -dayOfWeek;
endTime = time;
setEndMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day, dayOfWeek, time, after);
}
}
@Override
public void setRawOffset(int offset) {
rawOffset = offset;
icuTZ.setRawOffset(offset);
}
private void setStartMode() {
if (startDayOfWeek == 0) {
startMode = DOM_MODE;
} else if (startDayOfWeek < 0) {
startDayOfWeek = -startDayOfWeek;
if (startDay < 0) {
startDay = -startDay;
startMode = DOW_LE_DOM_MODE;
} else {
startMode = DOW_GE_DOM_MODE;
}
} else {
startMode = DOW_IN_MONTH_MODE;
}
useDaylight = startDay != 0 && endDay != 0;
if (startDay != 0) {
checkRange(startMonth, startMode == DOM_MODE ? 1 : startDayOfWeek, startTime);
if (startMode != DOW_IN_MONTH_MODE) {
checkDay(startMonth, startDay);
} else {
if (startDay < -5 || startDay > 5) {
throw new IllegalArgumentException(Messages.getString("luni.40", startDay)); //$NON-NLS-1$
}
}
}
if (startMode != DOM_MODE) {
startDayOfWeek--;
}
}
public void setStartRule(int month, int dayOfMonth, int time) {
startMonth = month;
startDay = dayOfMonth;
startDayOfWeek = 0; // Initialize this value for hasSameRules()
startTime = time;
setStartMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, dayOfMonth, time);
}
}
public void setStartRule(int month, int day, int dayOfWeek, int time) {
startMonth = month;
startDay = day;
startDayOfWeek = dayOfWeek;
startTime = time;
setStartMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day, dayOfWeek, time);
}
}
public void setStartRule(int month, int day, int dayOfWeek, int time, boolean after) {
startMonth = month;
startDay = after ? day : -day;
startDayOfWeek = -dayOfWeek;
startTime = time;
setStartMode();
if (isSimple) {
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day, dayOfWeek, time, after);
}
}
public void setStartYear(int year) {
startYear = year;
useDaylight = true;
}
@Override
public String toString() {
return getClass().getName() + "[id=" + getID() + ",offset=" + rawOffset + ",dstSavings=" + dstSavings +
",useDaylight=" + useDaylight + ",startYear=" + startYear + ",startMode=" + startMode + ",startMonth=" +
startMonth + ",startDay=" + startDay + ",startDayOfWeek=" +
(useDaylight && (startMode != DOM_MODE) ? startDayOfWeek + 1 : 0) + ",startTime=" + startTime +
",endMode=" + endMode + ",endMonth=" + endMonth + ",endDay=" + endDay + ",endDayOfWeek=" +
(useDaylight && (endMode != DOM_MODE) ? endDayOfWeek + 1 : 0) + ",endTime=" + endTime + "]";
}
@Override
public boolean useDaylightTime() {
return useDaylight;
}
}

View File

@ -1,288 +0,0 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.util;
import org.teavm.classlib.java.io.TSerializable;
import org.teavm.classlib.java.lang.TCloneable;
public abstract class TimeZone implements TSerializable, TCloneable {
private static final long serialVersionUID = 3581463369166924961L;
public static final int SHORT = 0;
public static final int LONG = 1;
private static THashMap<String, TimeZone> AvailableZones;
private static TimeZone Default;
static TimeZone GMT = new SimpleTimeZone(0, "GMT"); // Greenwich Mean Time
private String ID;
private static void initializeAvailable() {
TimeZone[] zones = TimeZones.getTimeZones();
AvailableZones = new THashMap<>((zones.length + 1) * 4 / 3);
AvailableZones.put(GMT.getID(), GMT);
for (int i = 0; i < zones.length; i++) {
AvailableZones.put(zones[i].getID(), zones[i]);
}
}
public TimeZone() {
}
@Override
public Object clone() {
try {
TimeZone zone = (TimeZone) super.clone();
return zone;
} catch (CloneNotSupportedException e) {
return null;
}
}
public static synchronized String[] getAvailableIDs() {
return AvailableZones.keySet().toArray(new String[0]);
}
public static synchronized String[] getAvailableIDs(int offset) {
TList<String> result = new TArrayList<>();
for (TIterator<TimeZone> iter = AvailableZones.values().iterator(); iter.hasNext();) {
TimeZone tz = iter.next();
if (tz.getRawOffset() == offset) {
result.add(tz.getID());
}
}
return result.toArray(new String[0]);
}
public static synchronized TimeZone getDefault() {
if (Default == null) {
setDefault(null);
}
return (TimeZone) Default.clone();
}
public final String getDisplayName() {
return getDisplayName(false, LONG, TLocale.getDefault());
}
public final String getDisplayName(TLocale locale) {
return getDisplayName(false, LONG, locale);
}
public final String getDisplayName(boolean daylightTime, int style) {
return getDisplayName(daylightTime, style, TLocale.getDefault());
}
public String getDisplayName(boolean daylightTime, int style, TLocale locale) {
if (icuTimeZone == null || !ID.equals(icuTimeZone.getID())) {
icuTimeZone = com.ibm.icu.util.TimeZone.getTimeZone(ID);
}
return icuTimeZone.getDisplayName(daylightTime, style, locale);
}
public String getID() {
return ID;
}
public int getDSTSavings() {
if (useDaylightTime()) {
return 3600000;
}
return 0;
}
public int getOffset(long time) {
if (inDaylightTime(new Date(time))) {
return getRawOffset() + getDSTSavings();
}
return getRawOffset();
}
abstract public int getOffset(int era, int year, int month, int day, int dayOfWeek, int time);
abstract public int getRawOffset();
public static synchronized TimeZone getTimeZone(String name) {
if (AvailableZones == null) {
initializeAvailable();
}
TimeZone zone = AvailableZones.get(name);
if (zone == null) {
if (name.startsWith("GMT") && name.length() > 3) {
char sign = name.charAt(3);
if (sign == '+' || sign == '-') {
int[] position = new int[1];
String formattedName = formatTimeZoneName(name, 4);
int hour = parseNumber(formattedName, 4, position);
if (hour < 0 || hour > 23) {
return (TimeZone) GMT.clone();
}
int index = position[0];
if (index != -1) {
int raw = hour * 3600000;
if (index < formattedName.length() && formattedName.charAt(index) == ':') {
int minute = parseNumber(formattedName, index + 1, position);
if (position[0] == -1 || minute < 0 || minute > 59) {
return (TimeZone) GMT.clone();
}
raw += minute * 60000;
} else if (hour >= 30 || index > 6) {
raw = (hour / 100 * 3600000) + (hour % 100 * 60000);
}
if (sign == '-') {
raw = -raw;
}
return new SimpleTimeZone(raw, formattedName);
}
}
}
zone = GMT;
}
return (TimeZone) zone.clone();
}
private static String formatTimeZoneName(String name, int offset) {
StringBuilder buf = new StringBuilder();
int index = offset, length = name.length();
buf.append(name.substring(0, offset));
while (index < length) {
if (Character.digit(name.charAt(index), 10) != -1) {
buf.append(name.charAt(index));
if ((length - (index + 1)) == 2) {
buf.append(':');
}
} else if (name.charAt(index) == ':') {
buf.append(':');
}
index++;
}
if (buf.toString().indexOf(":") == -1) {
buf.append(':');
buf.append("00");
}
if (buf.toString().indexOf(":") == 5) {
buf.insert(4, '0');
}
return buf.toString();
}
public boolean hasSameRules(TimeZone zone) {
if (zone == null) {
return false;
}
return getRawOffset() == zone.getRawOffset();
}
abstract public boolean inDaylightTime(Date time);
private static int parseNumber(String string, int offset, int[] position) {
int index = offset, length = string.length(), digit, result = 0;
while (index < length && (digit = Character.digit(string.charAt(index), 10)) != -1) {
index++;
result = result * 10 + digit;
}
position[0] = index == offset ? -1 : index;
return result;
}
public static synchronized void setDefault(TimeZone timezone) {
if (timezone != null) {
setICUDefaultTimeZone(timezone);
Default = timezone;
return;
}
String zone = AccessController.doPrivileged(new PriviAction<String>("user.timezone"));
// sometimes DRLVM incorrectly adds "\n" to the end of timezone ID
if (zone != null && zone.contains("\n")) {
zone = zone.substring(0, zone.indexOf("\n"));
}
// if property user.timezone is not set, we call the native method
// getCustomTimeZone
if (zone == null || zone.length() == 0) {
int[] tzinfo = new int[10];
boolean[] isCustomTimeZone = new boolean[1];
String zoneId = getCustomTimeZone(tzinfo, isCustomTimeZone);
// if returned TimeZone is a user customized TimeZone
if (isCustomTimeZone[0]) {
// build a new SimpleTimeZone
switch (tzinfo[1]) {
case 0:
// does not observe DST
Default = new SimpleTimeZone(tzinfo[0], zoneId);
break;
default:
// observes DST
Default = new SimpleTimeZone(tzinfo[0], zoneId, tzinfo[5], tzinfo[4], tzinfo[3], tzinfo[2],
tzinfo[9], tzinfo[8], tzinfo[7], tzinfo[6], tzinfo[1]);
}
} else {
// get TimeZone
Default = getTimeZone(zoneId);
}
} else {
// if property user.timezone is set in command line (with -D option)
Default = getTimeZone(zone);
}
setICUDefaultTimeZone(Default);
}
private static void setICUDefaultTimeZone(TimeZone timezone) {
final com.ibm.icu.util.TimeZone icuTZ = com.ibm.icu.util.TimeZone.getTimeZone(timezone.getID());
}
public void setID(String name) {
if (name == null) {
throw new NullPointerException();
}
ID = name;
}
abstract public void setRawOffset(int offset);
abstract public boolean useDaylightTime();
private static native String getCustomTimeZone(int[] tzinfo, boolean[] isCustomTimeZone);
}

View File

@ -1,707 +0,0 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.java.util;
final class TimeZones {
private static final int HALF_HOUR = 1800000;
private static final int ONE_HOUR = HALF_HOUR * 2;
public static TimeZone[] getTimeZones() {
return new TimeZone[] {
new SimpleTimeZone(-11 * ONE_HOUR, "MIT"), //$NON-NLS-1$
new SimpleTimeZone(-10 * ONE_HOUR, "HST"), //$NON-NLS-1$
new SimpleTimeZone(-9 * ONE_HOUR, "AST", Calendar.APRIL, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-8 * ONE_HOUR, "PST", Calendar.APRIL, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-7 * ONE_HOUR, "MST", Calendar.APRIL, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-7 * ONE_HOUR, "PNT"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR, "CST", Calendar.APRIL, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR, "EST", Calendar.APRIL, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR, "IET"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "PRT"), //$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR - 1800000,
"CNT", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 60000,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000),
new SimpleTimeZone(-3 * ONE_HOUR, "AGT"), //$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR, "BET", Calendar.OCTOBER, 8, //$NON-NLS-1$
-Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.FEBRUARY, 15,
-Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(0 * ONE_HOUR, "UTC"), //$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "WET", Calendar.MARCH, -1, //$NON-NLS-1$
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "ECT", Calendar.MARCH, -1, //$NON-NLS-1$
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "MET", Calendar.MARCH, 21, 0, //$NON-NLS-1$
0 * ONE_HOUR, Calendar.SEPTEMBER, 23, 0, 0 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "ART", Calendar.APRIL, -1, //$NON-NLS-1$
Calendar.FRIDAY, 0 * ONE_HOUR, Calendar.SEPTEMBER, -1,
Calendar.THURSDAY, 23 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "CAT"), //$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "EET", Calendar.MARCH, -1, //$NON-NLS-1$
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(3 * ONE_HOUR, "EAT"), //$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR + 1800000,
"Asia/Tehran", //$NON-NLS-1$
Calendar.MARCH, 21, 0, 0 * ONE_HOUR,
Calendar.SEPTEMBER, 23, 0, 0 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR, "NET", Calendar.MARCH, -1, //$NON-NLS-1$
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(5 * ONE_HOUR, "PLT"), //$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR + 1800000, "IST"), //$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "BST"), //$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "VST"), //$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "CTT"), //$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "JST"), //$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR + 1800000, "ACT"), //$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR, "AET", Calendar.OCTOBER, -1, //$NON-NLS-1$
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(11 * ONE_HOUR, "SST"), //$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "NST", Calendar.OCTOBER, 1, //$NON-NLS-1$
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, 15,
-Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-6 * ONE_HOUR, "America/Costa_Rica"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"America/Halifax", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-2 * ONE_HOUR, "Atlantic/South_Georgia"), //$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR,
"Europe/London", //$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Algiers"), //$NON-NLS-1$
new SimpleTimeZone(
2 * ONE_HOUR,
"Africa/Cairo", //$NON-NLS-1$
Calendar.APRIL, -1, Calendar.FRIDAY, 0 * ONE_HOUR,
Calendar.SEPTEMBER, -1, Calendar.THURSDAY,
23 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Harare"), //$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR,
"Asia/Jerusalem", //$NON-NLS-1$
Calendar.APRIL, 9, 0, 1 * ONE_HOUR, Calendar.SEPTEMBER,
24, 0, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Bucharest", //$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(3 * ONE_HOUR,
"Europe/Moscow", //$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR + 1800000, "Asia/Kabul"), //$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR + 1800000,
"Australia/Adelaide", Calendar.OCTOBER, -1, //$NON-NLS-1$
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(10 * ONE_HOUR, "Australia/Brisbane"), //$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR,
"Australia/Hobart", //$NON-NLS-1$
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-9 * ONE_HOUR - 1800000, "Pacific/Marquesas"), //$NON-NLS-1$
new SimpleTimeZone(-1 * ONE_HOUR,
"Atlantic/Azores", //$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Dubai"), //$NON-NLS-1$
new SimpleTimeZone(20700000, "Asia/Katmandu"), //$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR + 1800000, "Asia/Rangoon"), //$NON-NLS-1$
new SimpleTimeZone(45900000,
"Pacific/Chatham", //$NON-NLS-1$
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 9900000,
Calendar.MARCH, 15, -Calendar.SUNDAY, 9900000),
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Apia"), //$NON-NLS-1$
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Niue"), //$NON-NLS-1$
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Pago_Pago"), //$NON-NLS-1$
new SimpleTimeZone(-10 * ONE_HOUR,
"America/Adak", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Fakaofo"), //$NON-NLS-1$
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Honolulu"), //$NON-NLS-1$
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Rarotonga"), //$NON-NLS-1$
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Tahiti"), //$NON-NLS-1$
new SimpleTimeZone(-9 * ONE_HOUR,
"America/Anchorage", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-9 * ONE_HOUR, "Pacific/Gambier"), //$NON-NLS-1$
new SimpleTimeZone(-8 * ONE_HOUR,
"America/Los_Angeles", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-8 * ONE_HOUR,
"America/Tijuana", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-8 * ONE_HOUR,
"America/Vancouver", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-8 * ONE_HOUR, "Pacific/Pitcairn"), //$NON-NLS-1$
new SimpleTimeZone(-7 * ONE_HOUR, "America/Dawson_Creek"), //$NON-NLS-1$
new SimpleTimeZone(-7 * ONE_HOUR,
"America/Denver", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-7 * ONE_HOUR,
"America/Edmonton", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-7 * ONE_HOUR,
"America/Mazatlan", //$NON-NLS-1$
Calendar.MAY, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.SEPTEMBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-7 * ONE_HOUR, "America/Phoenix"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR, "America/Belize"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR,
"America/Chicago", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-6 * ONE_HOUR, "America/El_Salvador"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR, "America/Managua"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR,
"America/Mexico_City", //$NON-NLS-1$
Calendar.MAY, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.SEPTEMBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-6 * ONE_HOUR, "America/Regina"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR, "America/Tegucigalpa"), //$NON-NLS-1$
new SimpleTimeZone(-6 * ONE_HOUR,
"America/Winnipeg", //$NON-NLS-1$ //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-6 * ONE_HOUR,
"Pacific/Easter", //$NON-NLS-1$
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 4 * ONE_HOUR,
Calendar.MARCH, 9, -Calendar.SUNDAY, 3 * ONE_HOUR),
new SimpleTimeZone(-6 * ONE_HOUR, "Pacific/Galapagos"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Bogota"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Cayman"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR,
"America/Grand_Turk",//$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR, "America/Guayaquil"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR,
"America/Havana", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR, "America/Indianapolis"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Jamaica"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Lima"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR,
"America/Montreal", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR,
"America/Nassau", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR,
"America/New_York", //$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-5 * ONE_HOUR, "America/Panama"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Port-au-Prince"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Porto_Acre"), //$NON-NLS-1$
new SimpleTimeZone(-5 * ONE_HOUR, "America/Rio_Branco"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Anguilla"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Antigua"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Aruba"), //$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"America/Asuncion", //$NON-NLS-1$
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.MARCH, 1, -Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR, "America/Barbados"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Caracas"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"America/Cuiaba",//$NON-NLS-1$
Calendar.OCTOBER, 8, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.FEBRUARY, 15, -Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR, "America/Curacao"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Dominica"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Grenada"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Guadeloupe"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Guyana"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/La_Paz"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Manaus"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Martinique"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Montserrat"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Port_of_Spain"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/Puerto_Rico"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"America/Santiago",//$NON-NLS-1$
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 4 * ONE_HOUR,
Calendar.MARCH, 9, -Calendar.SUNDAY, 3 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR, "America/Santo_Domingo"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Kitts"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Lucia"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Thomas"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Vincent"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"America/Thule",//$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR, "America/Tortola"),//$NON-NLS-1$
new SimpleTimeZone(-4 * ONE_HOUR,
"Antarctica/Palmer",//$NON-NLS-1$
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR,
"Atlantic/Bermuda",//$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-4 * ONE_HOUR,
"Atlantic/Stanley",//$NON-NLS-1$
Calendar.SEPTEMBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.APRIL, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-3 * ONE_HOUR - 1800000,
"America/St_Johns",//$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 60000,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000),
new SimpleTimeZone(-3 * ONE_HOUR, "America/Buenos_Aires"),//$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR, "America/Cayenne"),//$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR, "America/Fortaleza"),//$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR,
"America/Godthab",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(-3 * ONE_HOUR,
"America/Miquelon",//$NON-NLS-1$
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(-3 * ONE_HOUR, "America/Montevideo"),//$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR, "America/Paramaribo"),//$NON-NLS-1$
new SimpleTimeZone(-3 * ONE_HOUR,
"America/Sao_Paulo",//$NON-NLS-1$
Calendar.OCTOBER, 8, -Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.FEBRUARY, 15, -Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(-2 * ONE_HOUR, "America/Noronha"),//$NON-NLS-1$
new SimpleTimeZone(-1 * ONE_HOUR,
"America/Scoresbysund",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(-1 * ONE_HOUR, "Atlantic/Cape_Verde"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Abidjan"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Accra"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Banjul"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Bissau"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Casablanca"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Conakry"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Dakar"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Freetown"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Lome"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Monrovia"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Nouakchott"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Ouagadougou"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Sao_Tome"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Timbuktu"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR,
"Atlantic/Canary",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(0 * ONE_HOUR,
"Atlantic/Faeroe",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(0 * ONE_HOUR, "Atlantic/Reykjavik"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR, "Atlantic/St_Helena"),//$NON-NLS-1$
new SimpleTimeZone(0 * ONE_HOUR,
"Europe/Dublin",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(0 * ONE_HOUR,
"Europe/Lisbon",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Bangui"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Douala"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Kinshasa"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Lagos"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Libreville"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Luanda"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Malabo"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Ndjamena"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Niamey"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Porto-Novo"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Tunis"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR,
"Africa/Windhoek",//$NON-NLS-1$
Calendar.SEPTEMBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "Atlantic/Jan_Mayen"),//$NON-NLS-1$
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Amsterdam",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Andorra",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Belgrade",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Berlin",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Brussels",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Budapest",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Copenhagen",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Gibraltar",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Luxembourg",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Madrid",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Malta",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Monaco",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "Europe/Oslo", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Paris",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Prague",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR, "Europe/Rome", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Stockholm",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Tirane",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Vaduz",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Vienna",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Warsaw",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(1 * ONE_HOUR,
"Europe/Zurich",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Blantyre"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Bujumbura"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Gaborone"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Johannesburg"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Kigali"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Lubumbashi"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Lusaka"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Maputo"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Maseru"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Mbabane"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Tripoli"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Asia/Amman", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.THURSDAY, 0 * ONE_HOUR,
Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 0 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Asia/Beirut", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Asia/Damascus",//$NON-NLS-1$
Calendar.APRIL, 1, 0, 0 * ONE_HOUR, Calendar.OCTOBER,
1, 0, 0 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Asia/Nicosia",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Athens",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Chisinau",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Helsinki",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Istanbul",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Kaliningrad",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Kiev", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Minsk",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Riga", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Simferopol",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR,
"Europe/Sofia",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Tallinn"),//$NON-NLS-1$
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Vilnius"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Addis_Ababa"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Asmera"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Dar_es_Salaam"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Djibouti"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Kampala"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Khartoum"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Mogadishu"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Nairobi"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Aden"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR,
"Asia/Baghdad",//$NON-NLS-1$
Calendar.APRIL, 1, 0, 3 * ONE_HOUR, Calendar.OCTOBER,
1, 0, 3 * ONE_HOUR),
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Bahrain"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Kuwait"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Qatar"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Riyadh"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Antananarivo"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Comoro"),//$NON-NLS-1$
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Mayotte"),//$NON-NLS-1$
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Aqtau", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Baku", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Muscat"),//$NON-NLS-1$
new SimpleTimeZone(4 * ONE_HOUR,
"Asia/Tbilisi",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 0 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR,
"Asia/Yerevan",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR,
"Europe/Samara",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Mahe"),//$NON-NLS-1$
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Mauritius"),//$NON-NLS-1$
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Reunion"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Aqtobe", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Ashgabat"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Ashkhabad"),//$NON-NLS-1$
new SimpleTimeZone(
5 * ONE_HOUR,
"Asia/Bishkek",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY,
2 * ONE_HOUR + 1800000, Calendar.OCTOBER, -1,
Calendar.SUNDAY, 2 * ONE_HOUR + 1800000),
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Dushanbe"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Karachi"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Tashkent"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR,
"Asia/Yekaterinburg",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(5 * ONE_HOUR, "Indian/Kerguelen"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR, "Indian/Maldives"),//$NON-NLS-1$
new SimpleTimeZone(5 * ONE_HOUR + 1800000, "Asia/Calcutta"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Antarctica/Mawson"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Almaty", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
new SimpleTimeZone(5 * ONE_HOUR + HALF_HOUR, "Asia/Colombo"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dacca"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dhaka"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR,
"Asia/Novosibirsk",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Thimbu"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Thimphu"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Indian/Chagos"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR + 1800000, "Indian/Cocos"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Bangkok"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Jakarta"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR,
"Asia/Krasnoyarsk",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Phnom_Penh"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Saigon"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Vientiane"),//$NON-NLS-1$
new SimpleTimeZone(7 * ONE_HOUR, "Indian/Christmas"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Antarctica/Casey"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Brunei"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Hong_Kong"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR,
"Asia/Irkutsk",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Kuala_Lumpur"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Macao"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Manila"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Shanghai"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Singapore"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Taipei"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ujung_Pandang"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ulaanbaatar"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ulan_Bator"),//$NON-NLS-1$
new SimpleTimeZone(8 * ONE_HOUR, "Australia/Perth"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Jayapura"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Pyongyang"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Seoul"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Tokyo"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR,
"Asia/Yakutsk",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR, "Pacific/Palau"),//$NON-NLS-1$
new SimpleTimeZone(9 * ONE_HOUR + 1800000,
"Australia/Broken_Hill", Calendar.OCTOBER, -1,//$NON-NLS-1$
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(9 * ONE_HOUR + 1800000, "Australia/Darwin"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR, "Antarctica/DumontDUrville"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR,
"Asia/Vladivostok",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(10 * ONE_HOUR,
"Australia/Sydney",//$NON-NLS-1$
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Guam"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Port_Moresby"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Saipan"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Truk"),//$NON-NLS-1$
new SimpleTimeZone(10 * ONE_HOUR + 1800000,
"Australia/Lord_Howe", Calendar.OCTOBER, -1,//$NON-NLS-1$
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
Calendar.SUNDAY, 2 * ONE_HOUR, 1800000),
new SimpleTimeZone(11 * ONE_HOUR,
"Asia/Magadan",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Efate"),//$NON-NLS-1$
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Guadalcanal"),//$NON-NLS-1$
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Kosrae"),//$NON-NLS-1$
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Noumea"),//$NON-NLS-1$
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Ponape"),//$NON-NLS-1$
new SimpleTimeZone(11 * ONE_HOUR + 1800000, "Pacific/Norfolk"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR,
"Antarctica/McMurdo",//$NON-NLS-1$
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.MARCH, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(12 * ONE_HOUR,
"Asia/Anadyr",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(12 * ONE_HOUR,
"Asia/Kamchatka",//$NON-NLS-1$
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(12 * ONE_HOUR,
"Pacific/Auckland",//$NON-NLS-1$
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
Calendar.MARCH, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Fiji"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Funafuti"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Majuro"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Nauru"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Tarawa"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Wake"),//$NON-NLS-1$
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Wallis"),//$NON-NLS-1$
new SimpleTimeZone(13 * ONE_HOUR, "Pacific/Enderbury"),//$NON-NLS-1$
new SimpleTimeZone(13 * ONE_HOUR, "Pacific/Tongatapu"),//$NON-NLS-1$
new SimpleTimeZone(14 * ONE_HOUR, "Pacific/Kiritimati"), };//$NON-NLS-1$
}
}